mdpo.cli module
mdpo command line interface utilities.
- mdpo.cli.add_check_option(parser)
Add the
--checkoption to an argument parser.- Parameters:
parser (
argparse.ArgumentParser) – Parser to extend.
- mdpo.cli.add_command_alias_argument(parser)
Add the
--command-aliasargument to an argument parser.- Parameters:
parser (
argparse.ArgumentParser) – Parser to extend.
- mdpo.cli.add_common_cli_first_arguments(parser)
Add common mdpo arguments to an argument parser at the beginning.
- Parameters:
parser (
argparse.ArgumentParser) – Parser to extend.
- mdpo.cli.add_debug_option(parser)
Add the
-D/--debugoption to an argument parser.- Parameters:
parser (
argparse.ArgumentParser) – Parser to extend.
- mdpo.cli.add_encoding_arguments(parser, po_encoding_help=None, markup_encoding='md')
Add
--po-encoding--md-encodingarguments to an argument parser.- Parameters:
parser (
argparse.ArgumentParser) – Parser to extend.po_encoding_help (str) – Help text for the
--po-encodingargument.markup_encoding (str) – Type of markup encoding, can be
"md"or"html".
- mdpo.cli.add_event_argument(parser)
Add the
--eventoptional argument to an argument parser.- Parameters:
parser (
argparse.ArgumentParser) – Parser to extend.
- mdpo.cli.add_extensions_argument(parser)
Add the
-x/--extensionargument to an argument parser.- Parameters:
parser (
argparse.ArgumentParser) – Parser to extend.
- mdpo.cli.add_include_codeblocks_option(parser)
Add the
--include-codeblocksoption to an argument parser.- Parameters:
parser (
argparse.ArgumentParser) – Parser to extend.
- mdpo.cli.add_no_empty_msgstr_option(parser)
Add the
--no-empty-msgstroption to an argument parser.- Parameters:
parser (
argparse.ArgumentParser) – Parser to extend.
- mdpo.cli.add_no_fuzzy_option(parser)
Add the
--no-fuzzyoption to an argument parser.- Parameters:
parser (
argparse.ArgumentParser) – Parser to extend.
- mdpo.cli.add_no_obsolete_option(parser)
Add the
--no-obsoleteoption to an argument parser.- Parameters:
parser (
argparse.ArgumentParser) – Parser to extend.
- mdpo.cli.add_nolocation_option(parser)
Add the
--no-location/--nolocationoption to an argument parser.- Parameters:
parser (
argparse.ArgumentParser) – Parser to extend.
- mdpo.cli.add_wrapwidth_argument(parser, markup='po', markup_prefix=False, short=True, default='78', help_to_render=None)
Add a
--wrapwidthargument to an argument parser.- Parameters:
parser (
argparse.ArgumentParser) – Parser to extend.markup (str) – For which type of files the argument will affect. Either
"md"for Markdown or"po"for PO files.markup_prefix (bool) – Add the
markupprefix in the argument using the format--<markup>-wrapwidth.short (bool) – Add the short version of the argument (
-w).default (str) – Default value.
help_to_render (str) – String used to indicate the content that will be wrapped according to the argument.
- mdpo.cli.cli_codespan(value, cli=True)
Command line codespan wrapper.
This is a compatibility function to make CLI codespans looks good in sphinx-argparse-cli documentation and using
--helpoption in CLI itself. sphinx-argparse-cli expects the usage of double backticks for codespans, but that format is ugly in CLI.
- mdpo.cli.parse_command_aliases_cli_arguments(command_aliases)
Parse
--command-aliasargument values passed to CLIs.If a value can’t be passed or a custom command is duplicated, writes an appropiate error message to STDERR and exits with code 1.
- mdpo.cli.parse_escaped_pairs_cli_argument(pairs, value_error_message, key_error_message)
Parse a key argument made by key-value pairs.
If an error happens, shows an appropiate message and exists with code 1.
- mdpo.cli.parse_event_argument(value)
Parse
--eventCLI argument values.
- mdpo.cli.parse_metadata_cli_arguments(metadata)
Parse
--metadataargument values passed to CLIs.If a value can’t be passed or a metadata key is duplicated, writes an appropiate error message to STDERR and exits with code 1.