[CLI][Added] defs-from-env allows using environment vars for substitution
Closes #549
This commit is contained in:
parent
2ba5b7101c
commit
7c7d3aff0b
|
|
@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- `--help-list-offsets` to list footprint offsets (JLCPCB)
|
||||
- `--help-list-rotations` to list footprint rotations (JLCPCB)
|
||||
- `--stop-on-warnings` (`-W`) to stop on warnings (#545)
|
||||
- `--defs-from-env` allows using environment vars for substitution (#549)
|
||||
- Global options:
|
||||
- `remove_solder_mask_for_dnp` similar to `remove_solder_paste_for_dnp` but
|
||||
applied to the solder mask apertures. (#476)
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@ files.
|
|||
|
||||
You can use ``-E`` as many times as you need.
|
||||
|
||||
Also note that the ``--def-from-env`` option adds all the environment
|
||||
variables as definitions.
|
||||
|
||||
.. index::
|
||||
pair: definitions; default
|
||||
|
|
|
|||
|
|
@ -3,10 +3,11 @@ KiBot: KiCad automation tool for documents generation
|
|||
Usage:
|
||||
kibot [-b BOARD] [-e SCHEMA] [-c CONFIG] [-d OUT_DIR] [-s PRE]
|
||||
[-q | -v...] [-L LOGFILE] [-C | -i | -n] [-m MKFILE] [-A] [-g DEF] ...
|
||||
[-E DEF] ... [-w LIST] [-D | -W] [--banner N] [TARGET...]
|
||||
[-E DEF] ... [--defs-from-env] [-w LIST] [-D | -W] [--banner N]
|
||||
[TARGET...]
|
||||
kibot [-v...] [-b BOARD] [-e SCHEMA] [-c PLOT_CONFIG] [--banner N]
|
||||
[-E DEF] ... [--config-outs] [--only-pre|--only-groups] [--only-names]
|
||||
[--output-name-first] --list
|
||||
[-E DEF] ... [--defs-from-env] [--config-outs]
|
||||
[--only-pre|--only-groups] [--only-names] [--output-name-first] --list
|
||||
kibot [-v...] [-c PLOT_CONFIG] [--banner N] [-E DEF] ... [--only-names]
|
||||
--list-variants
|
||||
kibot [-v...] [-b BOARD] [-d OUT_DIR] [-p | -P] [--banner N] --example
|
||||
|
|
@ -39,6 +40,8 @@ Options:
|
|||
--config-outs Configure all outputs before listing them
|
||||
-d OUT_DIR, --out-dir OUT_DIR The output directory [default: .]
|
||||
-D, --dont-stop Try to continue if an output fails
|
||||
--defs-from-env Use the environment vars as preprocessor
|
||||
values
|
||||
-e SCHEMA, --schematic SCHEMA The schematic file (.sch/.kicad_sch)
|
||||
-E DEF, --define DEF Define preprocessor value (VAR=VAL)
|
||||
-g DEF, --global-redef DEF Overwrite a global value (VAR=VAL)
|
||||
|
|
|
|||
|
|
@ -10,10 +10,11 @@
|
|||
Usage:
|
||||
kibot [-b BOARD] [-e SCHEMA] [-c CONFIG] [-d OUT_DIR] [-s PRE]
|
||||
[-q | -v...] [-L LOGFILE] [-C | -i | -n] [-m MKFILE] [-A] [-g DEF] ...
|
||||
[-E DEF] ... [-w LIST] [-D | -W] [--banner N] [TARGET...]
|
||||
[-E DEF] ... [--defs-from-env] [-w LIST] [-D | -W] [--banner N]
|
||||
[TARGET...]
|
||||
kibot [-v...] [-b BOARD] [-e SCHEMA] [-c PLOT_CONFIG] [--banner N]
|
||||
[-E DEF] ... [--config-outs] [--only-pre|--only-groups] [--only-names]
|
||||
[--output-name-first] --list
|
||||
[-E DEF] ... [--defs-from-env] [--config-outs]
|
||||
[--only-pre|--only-groups] [--only-names] [--output-name-first] --list
|
||||
kibot [-v...] [-c PLOT_CONFIG] [--banner N] [-E DEF] ... [--only-names]
|
||||
--list-variants
|
||||
kibot [-v...] [-b BOARD] [-d OUT_DIR] [-p | -P] [--banner N] --example
|
||||
|
|
@ -46,6 +47,8 @@ Options:
|
|||
--config-outs Configure all outputs before listing them
|
||||
-d OUT_DIR, --out-dir OUT_DIR The output directory [default: .]
|
||||
-D, --dont-stop Try to continue if an output fails
|
||||
--defs-from-env Use the environment vars as preprocessor
|
||||
values
|
||||
-e SCHEMA, --schematic SCHEMA The schematic file (.sch/.kicad_sch)
|
||||
-E DEF, --define DEF Define preprocessor value (VAR=VAL)
|
||||
-g DEF, --global-redef DEF Overwrite a global value (VAR=VAL)
|
||||
|
|
@ -340,6 +343,8 @@ def detect_kicad():
|
|||
|
||||
|
||||
def parse_defines(args):
|
||||
if args.defs_from_env:
|
||||
GS.cli_defines.update(os.environ)
|
||||
for define in args.define:
|
||||
if '=' not in define:
|
||||
GS.exit_with_error(f'Malformed `define` option, must be VARIABLE=VALUE ({define})', EXIT_BAD_ARGS)
|
||||
|
|
|
|||
Loading…
Reference in New Issue