Next: lepton-cli shell, Previous: lepton-cli export, Up: lepton-cli - Lepton command-line utility [Contents][Index]

### 7.2 lepton-cli config

This section describes how to set up Lepton tools with the `lepton-cli config` command.

`lepton-cli config` is a basic utility for inspecting and modifying Lepton EDA configuration stores.

The usage of the command:

    lepton-cli config [OPTION] [GROUP KEY [VALUE]]

If a GROUP and KEY are specified, it retrieves the value of that configuration parameter. If a VALUE is specified as well, it sets the value of that parameter.

The options `-p`, `-u`, and `-s`, listed below, can be used to select what configuration store should be affected (by default, the project configuration store for the current working directory). If no GROUP and KEY are provided, the command outputs the filename of the selected configuration store.

`-p [PATH]`
`--project[=PATH]`

  Select the project configuration store of the project located in PATH. If no PATH is provided, selects the project in the current working directory.

  > Note: Unlike `--project`, for which an optional argument must be specified using ‘`=`’, any argument after `-p` is considered to be a path, not a configuration group. It may be specified as ‘`-pPATH`’ or ‘`-p PATH`’. Please see examples below.

`-u`
`--user`

  Select the user configuration store.

`-s`
`--system`

  Select the system configuration store. Depending on user permissions, the system configuration store may be read-only.

`-c`
`--cache`

  Select the program-specific configuration store (CACHE configuration context).

#### 7.2.1 Configuration files

Configuration settings used to configure these programs are written to Lepton config files. Naming and location of those files, file format, as well as configuration settings available, are described in the chapter Configuration system.

You can easily find out the location of the configuration files in your system. For example, if you want to know where your user configuration is stored, just type:

    lepton-cli config -u
    -| /home/user/.config/lepton-eda/lepton-user.conf

Supposed you’re a system administrator and want to look where Lepton’s default system settings are stored, do:

    lepton-cli config -s
    -| /usr/local/share/lepton-eda/lepton-system.conf

Editing the system configuration file will probably require superuser permissions. If you want to look up and edit just one of the settings, you could do, for instance:

    lepton-cli config -s export font
    -| Sans
    sudo lepton-cli config -s export font Arial

The first of the above commands simply reads the file, so it doesn’t require additional permissions.

> Note: Apart from using `lepton-cli` for modifying the files, you can just edit them manually in your favorite text editor.

All the config files consist of sections, called groups, containing key-value pairs.

Values of some keys in the Lepton config files are lists. Note that unlike the lepton-cli export command, where several list separators can be used, the only separator between list values in the config files is semicolon ‘`;`’.

> Note: Always properly escape semicolons in key values. Use double quotes or backslash for that. Otherwise your shell may interpret your command wrong.

Another difference between `export` and `config` commands is that when using the latter, you always have to specify all parameters of the used list. Thus, for example, this command is wrong:

    lepton-cli config --project export size 1000

The right command will look like this:

    lepton-cli config --project export size "1000;1000"

> Note: All sizes in the configuration files, and therefore in the `lepton-cli config` command line, must be given in Adobe points (72 points = 1 inch). Suffixes such as ‘`pt`’, ‘`mm`’, and others, which can be used with the lepton-cli export command, are not yet supported in the config files. Fixes are welcome.

In some cases, your configuration may work wrongly if ever. While `lepton-cli` supports locales for the `export` command, it is not so for `config`.

> Note: It is recommended to always use dot (‘`.`’) as decimal point separator with `lepton-cli`.

Suppose, for example, that comma is used in your locale as decimal point separator. Despite it, the following command results with wrong values in your project’s configuration file, and the config just won’t work properly:

    lepton-cli config --project export align "1,0;0,0"

Unlike it, the following exporting command will work OK under such conditions:

    lepton-cli export -a 0,0:1.0 -o file.pdf file.sch

#### 7.2.2 lepton-cli config examples

#### 7.2.2.1 Difference between -p and –project

Please note the difference between specifying the options `-p` and `--project`. Supposed that your `lepton.conf` in the current working directory has the contents as follows:

    [export]
    dpi=144

the following commands work as expected:

    lepton-cli config --project=. export dpi
    -| 144
    lepton-cli config --project export dpi
    -| 144
    lepton-cli config -p . export dpi
    -| 144
    lepton-cli config -p. export dpi
    -| 144

while the following ones are wrong and output errors:

    lepton-cli config -p export dpi
    -| ERROR: Directory "export" does not exist.
    lepton-cli config -p=export dpi
    -| ERROR: Directory "=export" does not exist.

This is because any argument after `-p`, be it specified with space or without it between the option and the argument, is considered to be a path, not a configuration group, and the equal sign cannot be used as a separator like for `--project`. Conversely, the following command:

    lepton-cli config --project . export dpi

will silently exit and result in the following content in `./lepton.conf`:

    [.]
    export=dpi

which is not you would expect here, right? This is because an optional argument for the option `--project` must be used with ‘`=`’ as separator, not space. Therefore in the above command, ‘`.`’ was interpreted as a configuration group, and ‘`export`’ and ‘`dpi`’ as a key and its value within it.

#### 7.2.2.2 Set up exporting

Use the “landscape” layout by default for a local project:

    lepton-cli config --project export layout landscape

Use the “letter” paper size by default for all your printouts:

    lepton-cli config --user export paper na_letter

Set paper size to the definite value of 1x2 inch for a local project:

    lepton-cli config --project export size "72;144"

Set margins as a half of inch for left and right sides and as a quarter of inch for top and bottom for a local project:

    lepton-cli config --project export margins "18;36;18;36"

This command will align your project’s schematics to the right.

    lepton-cli config --project export align "1.0;0.5"

Export schematics in a project in color (note: ‘`False`’ or ‘`FALSE`’ will not work):

    lepton-cli config --project export monochrome false

Set up a custom user font:

    lepton-cli config --user export font "OpenGost Type B TT Italic"

Choose another font for a local project:

    lepton-cli config --project export font "Arial Bold"

#### 7.2.2.3 Set up netlisting

Use shorter net names for unnamed nets in all netlists:

    lepton-cli config --user netlist default-net-name net

Ensure that a local project will use hierarchical net names despite of settings in `lepton-user.conf`:

    lepton-cli config --project netlist.hierarchy traverse-hierarchy true

Promote ‘`net`’ attribute over ‘`netname`’:

    lepton-cli config --project netlist net-naming-priority net-attribute

#### 7.2.2.4 Set up lepton-schematic

Use shorter names for new pages:

    lepton-cli config --user schematic default-filename empty

Set up select component widget to always show all attributes:

    lepton-cli config --project schematic.library component-attributes "*"

Please be careful when using this command in the command line. If you forget the quotes, your shell will substitute the first file name in the working directory file list for the attribute name. This is most likely not what you want.

Display only attributes that are in the filter list:

    lepton-cli config --project lepton-schematic.library \
      component-attributes "refdes;device;description"

Please note that if you replace semicolons with commas, `lepton-schematic` will consider the string in quotes just one attribute name, which is obviously wrong, and you will see no attribute at all.

Sort component library in `lepton-schematic` alphabetically:

    lepton-cli config --user schematic.library sort true

Next: lepton-cli shell, Previous: lepton-cli export, Up: lepton-cli - Lepton command-line utility [Contents][Index]