-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Stephen Finucane <stephen@that.guru>
- Loading branch information
1 parent
03eeab0
commit e579e68
Showing
9 changed files
with
638 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Changes | ||
======= | ||
|
||
.. include:: ../ChangeLog | ||
:start-line: 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
Contribution | ||
============ | ||
|
||
We welcome all contributions to `sphinx-click`. | ||
|
||
Support | ||
------- | ||
|
||
Open and issue in the `issue tracker`_ for all support requests. | ||
`StackOverflow`_ is also worth considering. | ||
|
||
Reporting Issues | ||
---------------- | ||
|
||
Report all issues in the `issue tracker`_. When doing so, please include | ||
version information for: | ||
|
||
- Python | ||
- `click` | ||
- `sphinx-click` | ||
|
||
Submitting Patches | ||
------------------ | ||
|
||
All patches should be submitted as pull requests on the `GitHub project`_. | ||
|
||
- Include tests if fixing a bug | ||
|
||
- Clearly explain what you're trying to accomplish | ||
|
||
- Follow :pep:`8`. You can use the `pep8` tox target for this | ||
|
||
Testing | ||
------- | ||
|
||
`sphinx-click` uses `tox` and `unittest` for testing. To run all tests, run: | ||
|
||
.. code-block:: shell | ||
$ tox | ||
We support a number of Python versions. To list available environments, run: | ||
|
||
.. code-block:: shell | ||
$ tox --list | ||
To run one of these environments, such as `py27` which runs tests under Python | ||
2.7, run: | ||
|
||
.. code-block:: shell | ||
$ tox -e py27 | ||
.. _issue tracker: https://github.com/click-contrib/sphinx-click/issues | ||
.. _StackOverflow: https://stackoverflow.com | ||
.. _GitHub project: https://github.com/click-contrib/sphinx-click |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,26 @@ | ||
Welcome to sphinx-click's documentation! | ||
======================================== | ||
sphinx-click | ||
============ | ||
|
||
:mod:`sphinx-click <sphinx_click>` is a `Sphinx`__ plugin that allows you to | ||
automatically extract documentation from a `click-based`__ application and | ||
include it in your docs. | ||
|
||
__ http://www.sphinx-doc.org/ | ||
__ http://click.pocoo.org/ | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
:caption: Contents: | ||
|
||
installation | ||
usage | ||
contributing | ||
changelog | ||
|
||
.. seealso:: | ||
|
||
Indices and tables | ||
================== | ||
Module :mod:`click` | ||
This extension assumes you are using :mod:`click` to create your command | ||
line application. | ||
|
||
* :ref:`genindex` | ||
* :ref:`modindex` | ||
* :ref:`search` | ||
Module :mod:`sphinxcontrib.autoprogram` | ||
An equivalent library for use with :mod:`argparse`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Installation | ||
============ | ||
|
||
Install the plugin using `pip`: | ||
|
||
.. code-block:: shell | ||
$ pip install sphinx-click | ||
Alternatively, install from source by cloning this repo then running | ||
`setup.py`: | ||
|
||
.. code-block:: shell | ||
$ python setup.py install | ||
.. important:: | ||
|
||
Both the package you're referencing and any dependencies **must be | ||
installed**. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
Usage | ||
===== | ||
|
||
`sphinx-click` enables automatic documentation by way of a `Sphinx | ||
directive`__. | ||
|
||
.. rst:directive:: .. click:: module:parser | ||
Automatically extract documentation from a `click-based`__ application and | ||
include it in your docs. | ||
|
||
.. code-block:: rst | ||
.. click:: module:parser | ||
:prog: hello-world | ||
:show-nested: | ||
The directive takes the import name of the parser object as its sole | ||
argument. | ||
|
||
In addition, the following options are required: | ||
|
||
`:prog:` | ||
The name of your tool (or how it should appear in your documentation). For | ||
example, if you run your script as ``./boo --opts args`` then ``:prog:`` | ||
will be ``boo``. If this is not given, the module name is used. | ||
|
||
The following options are optional: | ||
|
||
`:show-nested:` | ||
Enable full documentation for sub-commands. | ||
|
||
__ http://www.sphinx-doc.org/en/stable/extdev/markupapi.html | ||
__ http://click.pocoo.org/ | ||
|
||
Example | ||
------- | ||
|
||
Take the below `click` application, which is defined in the `example_app` | ||
module: | ||
|
||
.. code-block:: python | ||
import click | ||
@click.group() | ||
def greet(): | ||
"""A sample command group.""" | ||
pass | ||
@greet.command() | ||
@click.argument('user') | ||
def hello(user): | ||
"""Greet a user.""" | ||
click.echo('Hello %s' % user) | ||
To document this, use the following: | ||
|
||
.. code-block:: rst | ||
.. click:: hello_world:greet | ||
:prog: hello-world | ||
If you wish to include full documentation for the subcommand, ``hello``, in the | ||
output, add the ``show-nested`` flag. | ||
|
||
.. code-block:: rst | ||
.. click:: hello_world:greet | ||
:prog: hello-world | ||
:show-nested: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.