Command Line Interface

import kloch
import kloch.cli
kloch.get_cli(argv=None, config: KlochConfig | 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 – the kloch config instance to use for running the cli

class kloch.cli.BaseParser(args: Namespace, config: KlochConfig)

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.