[CLI][Added] Option to list variants
- Also changed the default --list behavior to avoid configuring outputs - Old behavior can be obtained using --config-outs Related to #434
This commit is contained in:
parent
577acfe574
commit
f2f0ed1a9b
|
|
@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
### Added
|
||||
- General:
|
||||
- OS environment expansion in ${VAR}
|
||||
- Command line:
|
||||
- `--list-variants` List all available variants (See #434)
|
||||
- Global options:
|
||||
- `use_os_env_for_expand` to disable OS environment expansion
|
||||
- `environment`.`extra_os` to define environment variables
|
||||
|
|
@ -31,6 +33,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
### Changed
|
||||
- KiCad v6/7 schematic:
|
||||
- The hierarchy is expanded only if needed, i.e. value of an instance changed
|
||||
- List actions:
|
||||
- Now you must explicitly ask to configure outputs. Otherwise isn't needed.
|
||||
As a result you no longer need to have an SCH/PCB. Use `--config-outs` to
|
||||
get the old behavior.
|
||||
|
||||
### Fixed
|
||||
- KiCad v6/7 schematic:
|
||||
|
|
|
|||
|
|
@ -12,7 +12,9 @@ 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] ... --list
|
||||
[-E DEF] [--config-outs] ... --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
|
||||
kibot [-v...] [--start PATH] [-d OUT_DIR] [--dry] [--banner N]
|
||||
[-t, --type TYPE]... --quick-start
|
||||
|
|
@ -37,18 +39,23 @@ Options:
|
|||
--banner N Display banner number N (-1 == random)
|
||||
-c CONFIG, --plot-config CONFIG The plotting config file to use
|
||||
-C, --cli-order Generate outputs using the indicated order
|
||||
--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
|
||||
-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)
|
||||
-i, --invert-sel Generate the outputs not listed as targets
|
||||
-l, --list List available outputs (in the config file)
|
||||
-l, --list List available outputs (in the config file).
|
||||
You don't need to specify an SCH/PCB unless
|
||||
using --config-outs
|
||||
--list-variants List the available variants and exit
|
||||
-L, --log LOGFILE Log to LOGFILE using maximum debug level.
|
||||
Is independent of what is logged to stderr
|
||||
-m MKFILE, --makefile MKFILE Generate a Makefile (no targets created)
|
||||
-n, --no-priority Don't sort targets by priority
|
||||
-p, --copy-options Copy plot options from the PCB file
|
||||
--only-names Print only the names
|
||||
-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`
|
||||
|
|
@ -114,10 +121,11 @@ from .config_reader import (CfgYamlReader, print_outputs_help, print_output_help
|
|||
print_filters_help, print_global_options_help, print_dependencies, print_variants_help)
|
||||
from .kiplot import (generate_outputs, load_actions, config_output, generate_makefile, generate_examples, solve_schematic,
|
||||
solve_board_file, solve_project_file, check_board_file)
|
||||
from .registrable import RegOutput
|
||||
GS.kibot_version = __version__
|
||||
|
||||
|
||||
def list_pre_and_outs(logger, outputs):
|
||||
def list_pre_and_outs(logger, outputs, do_config):
|
||||
logger.info('Available actions:\n')
|
||||
pf = BasePreFlight.get_in_use_objs()
|
||||
if len(pf):
|
||||
|
|
@ -129,10 +137,25 @@ def list_pre_and_outs(logger, 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.
|
||||
config_output(o, dry=False)
|
||||
if do_config:
|
||||
config_output(o, dry=False)
|
||||
logger.info('- '+str(o))
|
||||
|
||||
|
||||
def list_variants(logger, only_names):
|
||||
variants = RegOutput.get_variants()
|
||||
if not variants:
|
||||
logger.info('No variants defined')
|
||||
return
|
||||
if only_names:
|
||||
for name in sorted(variants.keys()):
|
||||
logger.info(name)
|
||||
return
|
||||
logger.info("Available variants: 'comment/description' (name) [type]")
|
||||
for name in sorted(variants.keys()):
|
||||
logger.info('- '+str(variants[name]))
|
||||
|
||||
|
||||
def solve_config(a_plot_config):
|
||||
plot_config = a_plot_config
|
||||
if not plot_config:
|
||||
|
|
@ -399,12 +422,13 @@ def main():
|
|||
|
||||
# Determine the YAML file
|
||||
plot_config = solve_config(args.plot_config)
|
||||
# Determine the SCH file
|
||||
GS.set_sch(solve_schematic('.', args.schematic, args.board_file, plot_config))
|
||||
# Determine the PCB file
|
||||
GS.set_pcb(solve_board_file('.', args.board_file))
|
||||
# Determine the project file
|
||||
GS.set_pro(solve_project_file())
|
||||
if not (args.list or args.list_variants) or args.config_outs:
|
||||
# Determine the SCH file
|
||||
GS.set_sch(solve_schematic('.', args.schematic, args.board_file, plot_config))
|
||||
# Determine the PCB file
|
||||
GS.set_pcb(solve_board_file('.', args.board_file))
|
||||
# Determine the project file
|
||||
GS.set_pro(solve_project_file())
|
||||
|
||||
# Parse preprocessor defines
|
||||
parse_defines(args)
|
||||
|
|
@ -430,7 +454,11 @@ def main():
|
|||
|
||||
# Is just "list the available targets"?
|
||||
if args.list:
|
||||
list_pre_and_outs(logger, outputs)
|
||||
list_pre_and_outs(logger, outputs, args.config_outs)
|
||||
sys.exit(0)
|
||||
|
||||
if args.list_variants:
|
||||
list_variants(logger, args.only_names)
|
||||
sys.exit(0)
|
||||
|
||||
if args.makefile:
|
||||
|
|
|
|||
|
|
@ -98,6 +98,10 @@ class RegOutput(Optionable, Registrable):
|
|||
def get_variant(name):
|
||||
return RegOutput._def_variants[name]
|
||||
|
||||
@staticmethod
|
||||
def get_variants():
|
||||
return RegOutput._def_variants
|
||||
|
||||
@staticmethod
|
||||
def add_filters(filters):
|
||||
RegOutput._def_filters.update(filters)
|
||||
|
|
|
|||
Loading…
Reference in New Issue