Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor the extension to use a Sphinx Domain #34

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
typing and other improvements
  • Loading branch information
AA-Turner committed Jul 15, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 5819633bcb32ecf5a43bdf051f54c5f5a97e7508
2 changes: 1 addition & 1 deletion docs/changelog.rst
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ Change log
The following enhancements to the HTML output are described on the [Usage](https://sphinx-argparse.readthedocs.io/en/latest/usage.html) page.

* Optional command index.
* Optional ``:idxgroups:`` field to the directive for an command-by-group index.
* Optional ``:index-groups:`` field to the directive for an command-by-group index.
* A ``full_subcommand_name`` option to print fully-qualified sub-command headings.
This option helps when more than one sub-command offers a ``create`` or ``list`` or other
repeated sub-command.
8 changes: 4 additions & 4 deletions docs/usage.rst
Original file line number Diff line number Diff line change
@@ -107,7 +107,7 @@ Other useful directives

:passparser: This can be used if you don't have a function that returns an argument parser, but rather adds commands to it (`:func:` is then that function).

:idxgroups: This option is related to grouping related commands in an index.
:index-groups: This option is related to grouping related commands in an index.


Printing Fully Qualified Sub-Command Headings
@@ -169,16 +169,16 @@ To enable the more complex index, add the following to the project ``conf.py`` f
"commands_by_group_index_in_toctree": True,
}

Add the ``:idxgroups:`` option to the ``argparse`` directive in your documentation files.
Specify one or more groups that the command belongs to.
Add the ``:index-groups:`` option to the ``argparse`` directive in your documentation files.
Specify one or more groups that the command belongs to (comma-separated).

.. code-block:: reStructuredText

.. argparse::
:filename: ../test/sample.py
:func: parser
:prog: sample
:idxgroups: ["Basic Commands"]
:index-groups: Basic Commands

For an HTML build, the index is created with the file name ``commands-by-group.html`` in the output directory.
You can cross reference the index from other files with the ``:ref:`commands-by-group``` role.
Loading
Loading