[CLI] Added --only-names to --list

This commit is contained in:
Salvador E. Tropea 2023-05-17 11:17:44 -03:00
parent a44a9f43a6
commit 921b04a396
2 changed files with 20 additions and 12 deletions

View File

@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- OS environment expansion in ${VAR} - OS environment expansion in ${VAR}
- Command line: - Command line:
- `--list-variants` List all available variants (See #434) - `--list-variants` List all available variants (See #434)
- `--only-names` to make `--list` list only output names
- Global options: - Global options:
- `use_os_env_for_expand` to disable OS environment expansion - `use_os_env_for_expand` to disable OS environment expansion
- `environment`.`extra_os` to define environment variables - `environment`.`extra_os` to define environment variables

View File

@ -12,7 +12,7 @@ Usage:
[-q | -v...] [-L LOGFILE] [-C | -i | -n] [-m MKFILE] [-A] [-g DEF] ... [-q | -v...] [-L LOGFILE] [-C | -i | -n] [-m MKFILE] [-A] [-g DEF] ...
[-E DEF] ... [-w LIST] [--banner N] [TARGET...] [-E DEF] ... [-w LIST] [--banner N] [TARGET...]
kibot [-v...] [-b BOARD] [-e SCHEMA] [-c PLOT_CONFIG] [--banner N] 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] ... kibot [-v...] [-c PLOT_CONFIG] [--banner N] [-E DEF] [--only-names] ...
--list-variants --list-variants
kibot [-v...] [-b BOARD] [-d OUT_DIR] [-p | -P] [--banner N] --example kibot [-v...] [-b BOARD] [-d OUT_DIR] [-p | -P] [--banner N] --example
@ -125,21 +125,28 @@ from .registrable import RegOutput
GS.kibot_version = __version__ GS.kibot_version = __version__
def list_pre_and_outs(logger, outputs, do_config): def list_pre_and_outs(logger, outputs, do_config, only_names):
logger.info('Available actions:\n') if not only_names:
logger.info('Available actions:\n')
pf = BasePreFlight.get_in_use_objs() pf = BasePreFlight.get_in_use_objs()
if len(pf): if len(pf) and not only_names:
logger.info('Pre-flight:') logger.info('Pre-flight:')
for c in pf: for c in pf:
logger.info('- '+str(c)) logger.info('- '+str(c))
if len(outputs): if len(outputs):
logger.info('Outputs:') if not only_names:
for o in outputs: logger.info('Outputs:')
# Note: we can't do a `dry` config because some layer and field names can be validated only if we for o in outputs:
# load the schematic and the PCB. # Note: we can't do a `dry` config because some layer and field names can be validated only if we
if do_config: # load the schematic and the PCB.
config_output(o, dry=False) if do_config:
logger.info('- '+str(o)) 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): def list_variants(logger, only_names):
@ -456,7 +463,7 @@ def main():
# Is just "list the available targets"? # Is just "list the available targets"?
if args.list: 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) sys.exit(0)
if args.list_variants: if args.list_variants: