Skip to content

Commit

Permalink
docs: named examples in README
Browse files Browse the repository at this point in the history
  • Loading branch information
neithere committed Dec 30, 2023
1 parent 53cec53 commit 6682569
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ Installation
Examples
--------

Hello World
...........

A very simple application with one command:

.. code-block:: python
Expand All @@ -116,6 +119,9 @@ Run it:
$ ./app.py
Hello world
Type Annotations
................

Type annotations are used to infer argument types:

.. code-block:: python
Expand All @@ -133,6 +139,9 @@ annotation):
$ ./app.py 1 2 3
6
Multiple Commands
.................

An app with multiple commands:

.. code-block:: python
Expand All @@ -150,6 +159,9 @@ Run it:
$ ./app.py echo Hey
Hey
Modularity
..........

A potentially modular application with more control over the process:

.. code-block:: python
Expand Down Expand Up @@ -212,6 +224,9 @@ to CLI arguments)::

(The help messages have been simplified a bit for brevity.)

Decorators
..........

`Argh` easily maps plain Python functions to CLI. Sometimes this is not
enough; in these cases the powerful API of `argparse` is also available:

Expand Down

0 comments on commit 6682569

Please sign in to comment.