cli¶
CLI parser for page_dewarp.
This module defines a subclass of argparse.ArgumentParser to parse
CLI arguments from the user and store them in the global config.
ArgParser ¶
Bases:
Parser for command-line arguments using a global config.
This class extends argparse.ArgumentParser but hooks into the global
Config object (cfg), automatically populating arguments from defaults
and storing parsed values back into that config.
Source code in src/page_dewarp/cli.py
add_default_argument
class-attribute
instance-attribute
¶
Add an argument with defaults coming from the global config.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name_or_flags
|
|
Short or long flags, e.g. |
required |
arg_name
|
|
Name used as the config key. |
required |
action
|
|
Argparse action ( |
required |
help
|
|
Help text for argparse. |
required |
const
|
|
Constant value for actions such as |
required |
choices
|
|
Allowed values for this argument. |
required |
nargs
|
|
Number of arguments consumed. |
required |
metavar
|
|
Display name in usage messages. |
required |
required
|
|
Whether the argument is required. |
required |
get_description ¶
Return a generated help string for a Config field.
We look up the annotated type metadata (if any) to build an informative help string showing the type and default value.
Source code in src/page_dewarp/cli.py
set_config_param
classmethod
¶
get_config_param
classmethod
¶
prepare_arguments ¶
Define all the standard arguments available via the CLI.
Source code in src/page_dewarp/cli.py
store_parsed_config ¶
Write any parsed CLI options back into the global config.
stringify_hint ¶
Convert a type hint to a user-readable string representation.