Command Line Interface

import knots_hub
import knots_hub.cli
knots_hub.get_cli(config: HubConfig, filesystem: HubInstallFilesystem, 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

  • filesystem

class knots_hub.cli.BaseParser(args: Namespace, original_argv: List[str], config: HubConfig, filesystem: HubInstallFilesystem, 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: HubInstallFilesystem, 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 force_local_restart: bool

Force a restart with the locally installed executable, if any.

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.