CLI Module

This module defines command-line parsing and command execution entry points.

class yugiquery.cli.CredAction

Bases: Action

Custom argparse action for handling credential arguments.

class yugiquery.cli.CustomHelpFormatter

Bases: HelpFormatter

Custom help formatter to improve the formatting of command-line arguments in the help message.

__init__(prog)
yugiquery.cli.handle_cleanup(args)

Handle the ‘cleanup’ subcommand: set up logging, ensure git repo, and execute the cleanup routine.

yugiquery.cli.handle_fetch(args)

Handle the ‘fetch’ subcommand: set up logging, ensure git repo, and execute the data update workflow.

yugiquery.cli.handle_report(args)

Handle the ‘report’ subcommand: set up logging, ensure git repo, and execute the report generation workflow.

yugiquery.cli.handle_run(args)

Handle the ‘run’ subcommand: set up logging, ensure git repo, and execute the main workflow.

yugiquery.cli.set_cleanup_parser(target: _SubParsersAction | ArgumentParser | None = None) ArgumentParser

Configure the cleanup subparser with debug flags (e.g., –dryrun, –log-level, –log-file). Can be used as a subparser or standalone parser.

yugiquery.cli.set_debug_args(parser: ArgumentParser | _ArgumentGroup, log_only: bool = False) None

Add debugging related arguments (e.g., –dryrun, –log-level, –log-file) to the given parser or argument group.

Parameters:
  • parser (argparse.ArgumentParser | argparse._ArgumentGroup) – The parser or argument group to which the debug arguments should be added.

  • log_only (bool) – If True, only add logging related arguments and skip the –dryrun argument. Defaults to False.

yugiquery.cli.set_fetch_parser(target: _SubParsersAction | ArgumentParser | None = None) ArgumentParser

Configure the fetch subparser with arguments for data update options, progress bars, and debugging. Can be used as a subparser or standalone parser.

yugiquery.cli.set_report_parser(target: _SubParsersAction | ArgumentParser | None = None) ArgumentParser

Configure the report subparser with arguments for report generation options, progress bars, and debugging. Can be used as a subparser or standalone parser.

yugiquery.cli.set_run_parser(target: _SubParsersAction | ArgumentParser | None = None) ArgumentParser

Configure the run subparser with arguments for flows, cleanup, progress bars, and debugging. Can be used as a subparser or standalone parser.