3
0
Fork 0

Add docs for subcommands

This commit is contained in:
Lance Edgar 2023-11-24 14:22:22 -06:00
parent 8759fb8d37
commit 6b110e567a
4 changed files with 127 additions and 110 deletions

View file

@ -6,12 +6,19 @@ Top-level :term:`commands<command>` are primarily a way to group
:term:`subcommands<subcommand>`.
.. _running-commands:
Running a Command
-----------------
Top-level commands are installed in such a way that they are available
within the ``bin`` folder of the virtual environment. (Or the
``Scripts`` folder if on Windows.)
``Scripts`` folder if on Windows.) For instance:
.. code-block:: sh
cd /path/to/venv
bin/wutta --help
This folder should be in the ``PATH`` when the virtual environment is
activated, in which case you can just run the command by name, e.g.:
@ -64,6 +71,8 @@ subcommands.
:returncode: 1
.. _adding-commands:
Adding a New Command
--------------------
@ -87,8 +96,8 @@ First create your :class:`~wuttjamaican.cmd.base.Command` class, and a
cmd.run(*args)
Then register the :term:`entry point(s)<entry point>` in your
``setup.cfg``. The command name should not contain spaces but may
include hyphens or underscore etc.
``setup.cfg``. The command name should *not* contain spaces but *may*
include hyphen or underscore.
You can register more than one top-level command if needed; these
could refer to the same ``main()`` function (in which case they
@ -109,3 +118,6 @@ available:
cd /path/to/venv
bin/poser --help
bin/wutta-poser --help
You will then likely want to add subcommand(s) for this to be useful;
see :ref:`adding-subcommands`.