Skip to content

Commit

Permalink
Updated the readme with the new docstring behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucretiel committed Aug 10, 2017
1 parent 750479e commit c6ef4b6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -217,14 +217,16 @@ If the default value is a file object, such as ``sys.stdout``, then autocommand
Descriptions and docstrings
~~~~~~~~~~~~~~~~~~~~~~~~~~~

The ``autocommand`` decorator accepts ``description`` and ``epilog`` kwargs, corresponding to the `description <https://docs.python.org/3/library/argparse.html#description>`_ and `epilog <https://docs.python.org/3/library/argparse.html#epilog>`_ of the ``ArgumentParser``. If no description is given, but the decorated function has a docstring, then it is taken as the ``description`` for the ``ArgumentParser``
The ``autocommand`` decorator accepts ``description`` and ``epilog`` kwargs, corresponding to the `description <https://docs.python.org/3/library/argparse.html#description>`_ and `epilog <https://docs.python.org/3/library/argparse.html#epilog>`_ of the ``ArgumentParser``. If no description is given, but the decorated function has a docstring, then it is taken as the ``description`` for the ``ArgumentParser``. You can also provide both the description and epilog in the docstring by splitting it into two sections with 4 or more - characters.

.. code:: python
@autocommand(__name__, epilog='Some extra documentation in the epilog')
@autocommand(__name__)
def copy(infile=sys.stdin, outfile=sys.stdout):
'''
Copy an the contents of a file (or stdin) to another file (or stdout)
----------
Some extra documentation in the epilog
'''
with smart_open(infile) as istr:
with smart_open(outfile, 'w') as ostr:
Expand Down

0 comments on commit c6ef4b6

Please sign in to comment.