[CLI][Added] More clear --list output and --only-pre option
- Takes most of the #436 suggestions
This commit is contained in:
parent
1e971e2461
commit
ebc48f57d9
|
|
@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
- 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
|
- `--only-names` to make `--list` list only output names
|
||||||
|
- `--only-pre` to list only the preflights
|
||||||
- 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
|
||||||
|
|
|
||||||
|
|
@ -5533,7 +5533,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-pre] [--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
|
||||||
|
|
@ -5577,6 +5577,8 @@ Options:
|
||||||
-n, --no-priority Don't sort targets by priority
|
-n, --no-priority Don't sort targets by priority
|
||||||
-p, --copy-options Copy plot options from the PCB file
|
-p, --copy-options Copy plot options from the PCB file
|
||||||
--only-names Print only the names
|
--only-names Print only the names
|
||||||
|
--only-pre Print only the preflights. Note that
|
||||||
|
`--only-names` alone prints only the outputs
|
||||||
-P, --copy-and-expand As -p but expand the list of layers
|
-P, --copy-and-expand As -p but expand the list of layers
|
||||||
-q, --quiet Remove information logs
|
-q, --quiet Remove information logs
|
||||||
-s PRE, --skip-pre PRE Skip preflights, comma separated or `all`
|
-s PRE, --skip-pre PRE Skip preflights, comma separated or `all`
|
||||||
|
|
|
||||||
|
|
@ -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] [--only-names] ... --list
|
[-E DEF] [--config-outs] [--only-pre] [--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
|
||||||
|
|
@ -56,6 +56,8 @@ Options:
|
||||||
-n, --no-priority Don't sort targets by priority
|
-n, --no-priority Don't sort targets by priority
|
||||||
-p, --copy-options Copy plot options from the PCB file
|
-p, --copy-options Copy plot options from the PCB file
|
||||||
--only-names Print only the names
|
--only-names Print only the names
|
||||||
|
--only-pre Print only the preflights. Note that
|
||||||
|
`--only-names` alone prints only the outputs
|
||||||
-P, --copy-and-expand As -p but expand the list of layers
|
-P, --copy-and-expand As -p but expand the list of layers
|
||||||
-q, --quiet Remove information logs
|
-q, --quiet Remove information logs
|
||||||
-s PRE, --skip-pre PRE Skip preflights, comma separated or `all`
|
-s PRE, --skip-pre PRE Skip preflights, comma separated or `all`
|
||||||
|
|
@ -125,28 +127,45 @@ from .registrable import RegOutput
|
||||||
GS.kibot_version = __version__
|
GS.kibot_version = __version__
|
||||||
|
|
||||||
|
|
||||||
def list_pre_and_outs(logger, outputs, do_config, only_names):
|
def list_pre_and_outs_names(logger, outputs, do_config, only_pre):
|
||||||
if not only_names:
|
pf = BasePreFlight.get_in_use_names()
|
||||||
logger.info('Available actions:\n')
|
if len(pf) and only_pre:
|
||||||
|
for c in pf:
|
||||||
|
logger.info(c)
|
||||||
|
return
|
||||||
|
if len(outputs):
|
||||||
|
for o in outputs:
|
||||||
|
if do_config:
|
||||||
|
config_output(o, dry=False)
|
||||||
|
logger.info(o.name)
|
||||||
|
|
||||||
|
|
||||||
|
def list_pre_and_outs(logger, outputs, do_config, only_names, only_pre):
|
||||||
|
if only_names:
|
||||||
|
return list_pre_and_outs_names(logger, outputs, do_config, only_pre)
|
||||||
pf = BasePreFlight.get_in_use_objs()
|
pf = BasePreFlight.get_in_use_objs()
|
||||||
if len(pf) and not only_names:
|
if len(pf):
|
||||||
logger.info('Pre-flight:')
|
logger.info('Available pre-flights:')
|
||||||
for c in pf:
|
for c in pf:
|
||||||
logger.info('- '+str(c))
|
logger.info('- '+str(c))
|
||||||
if len(outputs):
|
if len(outputs) and not only_pre:
|
||||||
if not only_names:
|
logger.info("")
|
||||||
logger.info('Outputs:')
|
if len(outputs) and not only_pre:
|
||||||
|
logger.info("Available outputs: 'comment/description' (name) [type]")
|
||||||
for o in 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
|
# 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.
|
# load the schematic and the PCB.
|
||||||
if do_config:
|
if do_config:
|
||||||
config_output(o, dry=False)
|
config_output(o, dry=False)
|
||||||
logger.info('- '+str(o))
|
logger.info('- '+str(o))
|
||||||
else:
|
if len(pf):
|
||||||
for o in outputs:
|
logger.info("")
|
||||||
if do_config:
|
logger.info("You can use e.g. `kibot --skip-pre preflight_name1,preflight_name2` to")
|
||||||
config_output(o, dry=False)
|
logger.info("skip specific preflights (or pass `all` to skip them all).")
|
||||||
logger.info(o.name)
|
if len(outputs):
|
||||||
|
logger.info("")
|
||||||
|
logger.info("You can use e.g. `kibot output_name1 output_name1` to generate only")
|
||||||
|
logger.info("specific outputs by name.")
|
||||||
|
|
||||||
|
|
||||||
def list_variants(logger, only_names):
|
def list_variants(logger, only_names):
|
||||||
|
|
@ -463,7 +482,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, args.only_names)
|
list_pre_and_outs(logger, outputs, args.config_outs, args.only_names, args.only_pre)
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
if args.list_variants:
|
if args.list_variants:
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,10 @@ class BasePreFlight(Registrable):
|
||||||
def get_in_use_objs():
|
def get_in_use_objs():
|
||||||
return BasePreFlight._in_use.values()
|
return BasePreFlight._in_use.values()
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def get_in_use_names():
|
||||||
|
return BasePreFlight._in_use.keys()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _set_option(name, value):
|
def _set_option(name, value):
|
||||||
BasePreFlight._options[name] = value
|
BasePreFlight._options[name] = value
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue