From 921b04a396b80e5cb6b165831987ef00a5357251 Mon Sep 17 00:00:00 2001 From: "Salvador E. Tropea" Date: Wed, 17 May 2023 11:17:44 -0300 Subject: [PATCH] [CLI] Added --only-names to --list --- CHANGELOG.md | 1 + kibot/__main__.py | 31 +++++++++++++++++++------------ 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index edbd5d27..b2eb773b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - OS environment expansion in ${VAR} - Command line: - `--list-variants` List all available variants (See #434) + - `--only-names` to make `--list` list only output names - Global options: - `use_os_env_for_expand` to disable OS environment expansion - `environment`.`extra_os` to define environment variables diff --git a/kibot/__main__.py b/kibot/__main__.py index 717829de..ca6803b7 100644 --- a/kibot/__main__.py +++ b/kibot/__main__.py @@ -12,7 +12,7 @@ Usage: [-q | -v...] [-L LOGFILE] [-C | -i | -n] [-m MKFILE] [-A] [-g DEF] ... [-E DEF] ... [-w LIST] [--banner N] [TARGET...] kibot [-v...] [-b BOARD] [-e SCHEMA] [-c PLOT_CONFIG] [--banner N] - [-E DEF] [--config-outs] ... --list + [-E DEF] [--config-outs] [--only-names] ... --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 @@ -125,21 +125,28 @@ from .registrable import RegOutput GS.kibot_version = __version__ -def list_pre_and_outs(logger, outputs, do_config): - logger.info('Available actions:\n') +def list_pre_and_outs(logger, outputs, do_config, only_names): + if not only_names: + logger.info('Available actions:\n') pf = BasePreFlight.get_in_use_objs() - if len(pf): + if len(pf) and not only_names: logger.info('Pre-flight:') for c in pf: logger.info('- '+str(c)) if len(outputs): - logger.info('Outputs:') - for o in outputs: - # Note: we can't do a `dry` config because some layer and field names can be validated only if we - # load the schematic and the PCB. - if do_config: - config_output(o, dry=False) - logger.info('- '+str(o)) + if not only_names: + logger.info('Outputs:') + for o in outputs: + # Note: we can't do a `dry` config because some layer and field names can be validated only if we + # load the schematic and the PCB. + if do_config: + config_output(o, dry=False) + logger.info('- '+str(o)) + else: + for o in outputs: + if do_config: + config_output(o, dry=False) + logger.info(o.name) def list_variants(logger, only_names): @@ -456,7 +463,7 @@ def main(): # Is just "list the available targets"? if args.list: - list_pre_and_outs(logger, outputs, args.config_outs) + list_pre_and_outs(logger, outputs, args.config_outs, args.only_names) sys.exit(0) if args.list_variants: