cli.core package¶
Submodules¶
cli.core.app module¶
- class cli.core.app.Flags(sound_enabled: 'bool' = False, no_signal: 'bool' = False, log_enabled: 'bool' = False, git_clean: 'bool' = False, infinite: 'bool' = False, help_all: 'bool' = False, alarm_timeout: 'int' = 60)¶
Bases:
object- alarm_timeout: int = 60¶
- git_clean: bool = False¶
- help_all: bool = False¶
- infinite: bool = False¶
- log_enabled: bool = False¶
- no_signal: bool = False¶
- sound_enabled: bool = False¶
- cli.core.app.main() None¶
cli.core.colors module¶
- class cli.core.colors.Fore¶
Bases:
object- BLACK = '\x1b[30m'¶
- BLUE = '\x1b[34m'¶
- CYAN = '\x1b[36m'¶
- GREEN = '\x1b[32m'¶
- MAGENTA = '\x1b[35m'¶
- RED = '\x1b[31m'¶
- WHITE = '\x1b[37m'¶
- YELLOW = '\x1b[33m'¶
- class cli.core.colors.Style¶
Bases:
object- BRIGHT = '\x1b[1m'¶
- DIM = '\x1b[2m'¶
- RESET_ALL = '\x1b[0m'¶
- cli.core.colors.color_text(text: str, color: str) str¶
cli.core.discovery module¶
- class cli.core.discovery.Command(parts: Tuple[str, ...], module: str, main_path: Path)¶
Bases:
objectA CLI command is a Python package directory under cli/ that contains __main__.py.
Example
cli/build/tree/__main__.py -> parts=(“build”,”tree”), module=”cli.build.tree”
- property folder: str | None¶
- module: str¶
- property name: str¶
- parts: Tuple[str, ...]¶
- property subcommand: str¶
- cli.core.discovery.discover_commands(cli_dir: Path) List[Command]¶
Recursively find all packages under cli_dir that contain __main__.py.
- cli.core.discovery.resolve_command_module(cli_dir: Path, argv_parts: List[str]) tuple[str | None, List[str]]¶
Resolve the longest argv prefix that matches a discovered command module.
- Returns:
(module, remaining_args)
Example
argv_parts=[“deploy”,”container”,”–foo”,”bar”] -> (“cli.deploy.container”, [”–foo”,”bar”])
cli.core.git module¶
- cli.core.git.git_clean_repo() None¶
cli.core.help module¶
- cli.core.help.extract_description_via_help(module: str) str¶
Best-effort: run “python -m <module> –help” and extract the first paragraph after usage.
- cli.core.help.format_command_help(name: str, description: str, indent: int = 2, col_width: int = 36, width: int = 80) str¶
cli.core.run module¶
cli.core.sounds module¶
- cli.core.sounds.failure_with_warning_loop(no_signal: bool, sound_enabled: bool, alarm_timeout: int = 60) None¶
Plays a warning sound in a loop until timeout; Ctrl+C stops earlier. Sound playback is isolated in a child process to avoid segfaulting the main process.
- cli.core.sounds.init_multiprocessing() None¶
- cli.core.sounds.play_sound_in_child(method_name: str) bool¶
- cli.core.sounds.play_start_intro_async() None¶