mdpo.cli module
mdpo command line interface utilities.
- mdpo.cli.add_check_option(parser)
Add the
--check
option to an argument parser.- Parameters:
parser (
argparse.ArgumentParser
) – Parser to extend.
- mdpo.cli.add_command_alias_argument(parser)
Add the
--command-alias
argument 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/--debug
option 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-encoding
arguments to an argument parser.- Parameters:
parser (
argparse.ArgumentParser
) – Parser to extend.po_encoding_help (str) – Help text for the
--po-encoding
argument.markup_encoding (str) – Type of markup encoding, can be
"md"
or"html"
.
- mdpo.cli.add_event_argument(parser)
Add the
--event
optional argument to an argument parser.- Parameters:
parser (
argparse.ArgumentParser
) – Parser to extend.
- mdpo.cli.add_extensions_argument(parser)
Add the
-x/--extension
argument to an argument parser.- Parameters:
parser (
argparse.ArgumentParser
) – Parser to extend.
- mdpo.cli.add_include_codeblocks_option(parser)
Add the
--include-codeblocks
option to an argument parser.- Parameters:
parser (
argparse.ArgumentParser
) – Parser to extend.
- mdpo.cli.add_no_empty_msgstr_option(parser)
Add the
--no-empty-msgstr
option to an argument parser.- Parameters:
parser (
argparse.ArgumentParser
) – Parser to extend.
- mdpo.cli.add_no_fuzzy_option(parser)
Add the
--no-fuzzy
option to an argument parser.- Parameters:
parser (
argparse.ArgumentParser
) – Parser to extend.
- mdpo.cli.add_no_obsolete_option(parser)
Add the
--no-obsolete
option to an argument parser.- Parameters:
parser (
argparse.ArgumentParser
) – Parser to extend.
- mdpo.cli.add_nolocation_option(parser)
Add the
--no-location/--nolocation
option 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
--wrapwidth
argument 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
markup
prefix 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
--help
option 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-alias
argument 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
--event
CLI argument values.
- mdpo.cli.parse_metadata_cli_arguments(metadata)
Parse
--metadata
argument 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.