# Command-Line Usage

The CLI for sphobjinv is implemented using two subcommands:

> - A convert subcommand, which handles conversion of inventories between supported formats (currently zlib-compressed, plaintext, and JSON).

> - A suggest subcommand, which provides suggestions for objects in an inventory matching a desired search term.

More information about the underlying implementation of these subcommands can be found here and in the documentation for the `Inventory` object, in particular the `data_file()` and `suggest()` methods.

Some notes on these CLI docs:

> - CLI docs examples are executed in a sandboxed directory pre-loaded with objects_attrs.inv (from, e.g., here).

> - `Path` (from `pathlib`) is imported into the namespace before all tests.

> - cli_run is a helper function that enables doctesting of CLI examples by mimicking execution of a shell command. It is described in more detail here.

> - file_head is a helper function that retrieves the head of a specified file.

The options for the parent sphobjinv command are:

-h, --help

  Show help message and exit

    usage: sphobjinv [-h] [-v] {convert,suggest} ...

    Format conversion for and introspection of intersphinx 'objects.inv' files.

    options:
      -h, --help         show this help message and exit
      -v, --version      Print package version & other info

    Subcommands:
      {convert,suggest}  Execution mode. Type 'sphobjinv [mode] -h' for more
                         information on available options. Mode names can be
                         abbreviated to their first two letters.
        convert (co)     Convert intersphinx inventory to zlib-compressed,
                         plaintext, or JSON formats.
        suggest (su)     Fuzzy-search intersphinx inventory for desired object(s).

-v, --version

  Print package version & other info

    sphobjinv v2.3.1.2

    Copyright (c) Brian Skinn 2016-2024
    License: The MIT License

    Bug reports & feature requests: https://github.com/bskinn/sphobjinv
    Documentation: https://sphobjinv.readthedocs.io