Skip to content

Commit

Permalink
[CLI][Added] Option to also list sub-PCBs found in variants
Browse files Browse the repository at this point in the history
  • Loading branch information
set-soft committed Aug 5, 2024
1 parent 08390b2 commit 830e6ea
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Testpoints_by_attr, Testpoints_by_attr_CSV, Testpoints_by_attr_HTML,
Testpoints_by_value, Testpoints_by_value_CSV and Testpoints_by_value_HTML:
Used to generate testpoint reports (#638)
- Command line:
- Option to also list sub-PCBs found in variants
- BoM: logo file name can contain env vars and/or ~ (#620)
- Datasheet: option to classify the datasheets by reference.
- KiCost: option to specify a configuration file (#615)
Expand Down
4 changes: 4 additions & 0 deletions docs/source/Changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ Added
Testpoints_by_value_CSV and Testpoints_by_value_HTML: Used to
generate testpoint reports (#638)

- Command line:

- Option to also list sub-PCBs found in variants

- BoM: logo file name can contain env vars and/or ~ (#620)
- Datasheet: option to classify the datasheets by reference.
- KiCost: option to specify a configuration file (#615)
Expand Down
3 changes: 2 additions & 1 deletion docs/source/usage.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Usage:
[-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
[--sub-pcbs] --list-variants
kibot [-v...] [-b BOARD] [-d OUT_DIR] [-p | -P] [--banner N] --example
kibot [-v...] [--start PATH] [-d OUT_DIR] [--dry] [--banner N]
[-t, --type TYPE]... --quick-start
Expand Down Expand Up @@ -65,6 +65,7 @@ Options:
-P, --copy-and-expand As -p but expand the list of layers
-q, --quiet Remove information logs
-s PRE, --skip-pre PRE Skip preflights, comma separated or `all`
--sub-pcbs When listing variants also include sub-PCBs
-v, --verbose Show debugging information
-V, --version Show program's version number and exit
-w, --no-warn LIST Exclude the mentioned warnings (comma sep)
Expand Down
18 changes: 14 additions & 4 deletions kibot/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
[-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
[--sub-pcbs] --list-variants
kibot [-v...] [-b BOARD] [-d OUT_DIR] [-p | -P] [--banner N] --example
kibot [-v...] [--start PATH] [-d OUT_DIR] [--dry] [--banner N]
[-t, --type TYPE]... --quick-start
Expand Down Expand Up @@ -72,6 +72,7 @@
-P, --copy-and-expand As -p but expand the list of layers
-q, --quiet Remove information logs
-s PRE, --skip-pre PRE Skip preflights, comma separated or `all`
--sub-pcbs When listing variants also include sub-PCBs
-v, --verbose Show debugging information
-V, --version Show program's version number and exit
-w, --no-warn LIST Exclude the mentioned warnings (comma sep)
Expand Down Expand Up @@ -204,19 +205,28 @@ def list_pre_and_outs(logger, outputs, do_config, only_names, only_pre, only_gro
logger.info("")


def list_variants(logger, only_names):
def list_variants(logger, only_names, sub_pcbs):
variants = RegOutput.get_variants()
if not variants:
if not only_names:
logger.info('No variants defined')
return
if only_names:
for name in sorted(variants.keys()):
logger.info(name)
v = variants[name]
if sub_pcbs and v.sub_pcbs:
for s in v.sub_pcbs:
logger.info(f'{name}[{s.name}]')
else:
logger.info(name)
return
logger.info("Available variants: 'comment/description' (name) [type]")
for name in sorted(variants.keys()):
logger.info('- '+str(variants[name]))
v = variants[name]
if sub_pcbs and v.sub_pcbs:
for s in v.sub_pcbs:
logger.info(f' - {s.name}')


def solve_config(a_plot_config, quiet=False):
Expand Down Expand Up @@ -569,7 +579,7 @@ def main():
sys.exit(0)

if args.list_variants:
list_variants(logger, args.only_names)
list_variants(logger, args.only_names, args.sub_pcbs)
sys.exit(0)

if args.makefile:
Expand Down

0 comments on commit 830e6ea

Please sign in to comment.