Command Line Interface¶
import knots_hub
import knots_hub.cli
- knots_hub.get_cli(config: HubConfig, filesystem: HubLocalFilesystem, argv: list[str] | None = None) BaseParser ¶
Return the command line interface generated from user arguments provided.
- Parameters:
argv – source command line argument to use instea dof the usual sys.argv
config – user-defined runtime configuration of the hub
filesystem – collection of paths for storing runtime data
- class knots_hub.cli.BaseParser(args: Namespace, original_argv: list[str], config: HubConfig, filesystem: HubLocalFilesystem, extra_args: list[str])¶
The root CLI parser who’s all subparsers use as base.
All arguments defined here are accessible by subparsers.
- Parameters:
args – user command line argument already parsed by argparse
- __init__(args: Namespace, original_argv: list[str], config: HubConfig, filesystem: HubLocalFilesystem, extra_args: list[str])¶
- classmethod add_to_parser(parser: ArgumentParser)¶
Configure the given argparse ArgumentParser.
- property debug: bool¶
True to execute the CLI in debug mode. Usually with more verbose logging.
- abstract execute()¶
Arbitrary code that must be executed when the user ask this command.
- property log_environ: bool¶
True will log the current system environment variable. Also need the debug flag.
- property no_coloring: bool¶
Disable colored logging, in case your system doesn’t support it.