haniwers.v1.cli.main#
Main entry point for haniwers v1 CLI.
This module defines the main Typer app and registers all subcommands. Handles global options like --env, --config, --verbose, and --logfile that are shared across all commands.
Architecture: - Global callback for environment, configuration, and logging setup - Subcommands registered from separate modules (config, daq, scan) - Context object stores global configuration for subcommands - Logging configured based on global --verbose and --logfile options
Module Contents#
Functions#
Load environment variables and configure logging. |
Data#
API#
- haniwers.v1.cli.main.app#
‘Typer(…)’
- haniwers.v1.cli.main.main(ctx: typer.Context, env_path: pathlib.Path = typer.Option(Path('.env.haniwers'), '--env', help='Path to .env file'), config_path: pathlib.Path = typer.Option(None, '--config', '-c', help='Path to config file'), verbose: bool = typer.Option(False, '--verbose', '-v', help='Enable verbose output (DEBUG level logging)', rich_help_panel='Global Options'), logfile: str = typer.Option(None, '--logfile', help='Write logs to file (in addition to stderr)', rich_help_panel='Global Options')) None#
Load environment variables and configure logging.
This callback runs before any subcommand executes. It:
Loads environment variables from the specified .env file
Configures logging based on --verbose and --logfile options
Stores configuration in the Typer context for subcommands to access
Args: ctx: Typer context (automatically provided) env_path: Path to environment file (.env.haniwers by default) config_path: Path to configuration TOML file (optional) verbose: Enable DEBUG level logging to stderr logfile: Optional file path to write logs to
Example: \( haniwers-v1 --verbose daq \) haniwers-v1 --logfile logs/run.log preprocess run2csv 1 $ haniwers-v1 --verbose --logfile logs/debug.log --config custom.toml daq