sphobjinv.cli.parser
sphobjinv
CLI parser definition module.
sphobjinv
is a toolkit for manipulation and inspection of
Sphinx objects.inv files.
- Author
Brian Skinn (brian.skinn@gmail.com)
- File Created
15 Nov 2020
- Copyright
(c) Brian Skinn 2016-2022
- Source Repository
- Documentation
- License
Code: MIT License
Docs & Docstrings: CC BY 4.0 International License
See LICENSE.txt for full license terms.
Members
- class PrsConst
Container for CLI parser constants.
- ALL = 'all'
Optional argument name for use with the
SUGGEST
subparser, indicating to print all returned objects, regardless of the number returned, without asking for confirmation
- CONTRACT = 'contract'
Optional argument name for use with the
CONVERT
subparser, indicating to contract URIs and display names to abbreviated forms in the generated output file
- CONVERT = 'convert'
Subparser name for inventory file conversions; stored in
SUBPARSER_NAME
when selected
- DEF_OUT_EXT = {'json': '.json', 'plain': '.txt', 'zlib': '.inv'}
Default extensions for an unspecified
OUTFILE
- DEF_THRESH = 75
Default match threshold for
sphobjinv suggest --thresh
- EXPAND = 'expand'
Optional argument name for use with the
CONVERT
subparser, indicating to expand URI and display name abbreviations in the generated output file
- FOUND_URL = 'found_url'
Dict key for URL at which an inventory was actually found
- HELP_CONV_EXTS = "'.inv/.txt/.json'"
Help text for default extensions for the various conversion types
- HELP_CO_PARSER = 'Convert intersphinx inventory to zlib-compressed, plaintext, or JSON formats.'
Help text for the
CONVERT
subparser
- HELP_SU_PARSER = 'Fuzzy-search intersphinx inventory for desired object(s).'
Help text for the
SUGGEST
subparser
- INDEX = 'index'
Optional argument name for use with the
SUGGEST
subparser, indicating to print the location index of each returned object withinINFILE
along with the object domain/role/name (may be specified withSCORE
)
- INFILE = 'infile'
Required positional argument name for use with both
CONVERT
andSUGGEST
subparsers, holding the path (or URL, ifURL
is specified) to the input file
- MODE = 'mode'
Positional argument name for use with
CONVERT
subparser, indicating output file format (ZLIB
,PLAIN
orJSON
)
- OUTFILE = 'outfile'
Optional positional argument name for use with the
CONVERT
subparser, holding the path to the output file (DEF_BASENAME
and the appropriate item fromDEF_OUT_EXT
are used if this argument is not provided)
- OVERWRITE = 'overwrite'
Optional argument name for use with the
CONVERT
subparser, indicating to overwrite any existing output file without prompting
- PAGINATE = 'paginate'
Optional argument name for use with the
SUGGEST
subparser, indicating to paginate the suggest subcommand results
- QUIET = 'quiet'
Optional argument name for use with the
CONVERT
subparser, indicating to suppress console output
- SCORE = 'score'
Optional argument name for use with the
SUGGEST
subparser, indicating to print thefuzzywuzzy
score of each returned object withinINFILE
along with the object domain/role/name (may be specified withINDEX
)
- SEARCH = 'search'
Positional argument name for use with the
SUGGEST
subparser, holding the search term forfuzzywuzzy
text matching
- SUGGEST = 'suggest'
Subparser name for inventory object suggestions; stored in
SUBPARSER_NAME
when selected
- SUGGEST_CONFIRM_LENGTH = 30
Number of returned objects from a
SUGGEST
subparser invocation above which user will be prompted for confirmation to print the results (unlessALL
is specified)
- THRESH = 'thresh'
Optional argument name for use with the
SUGGEST
subparser, taking the minimum desiredfuzzywuzzy
match quality as one required argument
- URL = 'url'
Optional argument name for use with both
CONVERT
andSUGGEST
subparsers, indicating thatINFILE
is to be treated as a URL rather than a local file path
- VERSION = 'version'
Optional argument name for use with the base argument parser, to show version &c. info, and exit
- VER_TXT = '\nsphobjinv v2.3.1\n\nCopyright (c) Brian Skinn 2016-2022\nLicense: The MIT License\n\nBug reports & feature requests: https://github.com/bskinn/sphobjinv\nDocumentation: https://sphobjinv.readthedocs.io\n'
Version &c. output blurb
- getparser()
Generate argument parser.
- Returns
prs –
ArgumentParser
– Parser for commandline usage of sphobjinv