Command Line Interface

import kloch
import kloch.cli
kloch.get_cli(argv: List[str] | None = None, config: KlochConfig | None = None) BaseParser

Return the command line interface generated from user arguments provided.

Parameters:
  • argv – command line arguments; from sys.argv if not provided

  • config – the kloch config instance to use for running the cli

kloch.run_cli(argv: List[str] | None = None)

Execute the CLI based on the provided user arguments.

Parameters:

argv – command line arguments; from sys.argv if not provided

class kloch.cli.BaseParser(args: Namespace, config: KlochConfig, original_argv: List[str])

The root 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

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 profile_roots: List[Path]

One or multiple filesystem path to existing directory containing profile file. The paths are append to the global profile roots variable.