sphobjinv.cli.core

sphobjinv CLI core execution module.

sphobjinv is a toolkit for manipulation and inspection of Sphinx objects.inv files.

Author

Brian Skinn (bskinn@alum.mit.edu)

File Created

15 Nov 2020

Copyright

(c) Brian Skinn 2016-2021

Source Repository

https://github.com/bskinn/sphobjinv

Documentation

https://sphobjinv.readthedocs.io/en/latest

License

The MIT License; see LICENSE.txt for full license terms

Members

do_convert(inv, in_path, params)

Carry out the conversion operation, including writing output.

If OVERWRITE is passed and the output file (the default location, or as passed to OUTFILE) exists, it will be overwritten without a prompt. Otherwise, the user will be queried if it is desired to overwrite the existing file.

If QUIET is passed, nothing will be printed to stdout (potentially useful for scripting), and any existing output file will be overwritten without prompting.

Parameters
  • invInventory – Inventory object to be output in the format indicated by MODE.

  • in_pathstr – For a local input file, its absolute path. For a URL, the (possibly truncated) URL text.

  • paramsdict – Parameters/values mapping from the active subparser

do_suggest(inv, params)

Perform the suggest call and output the results.

Results are printed one per line.

If neither INDEX nor SCORE is specified, the results are output without a header. If either or both are specified, the results are output in a lightweight tabular format.

If the number of results exceeds SUGGEST_CONFIRM_LENGTH, the user will be queried whether to display all of the returned results unless ALL is specified.

No -\-quiet option is available here, since a silent mode for suggestion output is nonsensical.

Parameters
  • invInventory – Inventory object to be output in the format indicated by MODE.

  • paramsdict – Parameters/values mapping from the active subparser

main()

Handle command line invocation.

Parses command line arguments, handling the no-arguments and VERSION cases.

Creates the Inventory from the indicated source and method.

Invokes do_convert() or do_suggest() per the subparser name stored in SUBPARSER_NAME.