File: sample.rst

package info (click to toggle)
sphinx-argparse 0.5.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 288 kB
  • sloc: python: 1,514; makefile: 133
file content (120 lines) | stat: -rw-r--r-- 1,864 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
Examples
========

Example documentation structure
-------------------------------

Here is an example structure for the documentation of a complex command with many subcommands.
You are free to use any structure, but this may be a good starting point.

File "index.rst":

.. code:: rst

   .. toctree::
      :maxdepth: 2

      cmd

File "cmd.rst":

.. code:: rst

   Command line utilities
   **********************

   .. toctree::
      :maxdepth: 1

      cmd_main
      cmd_subcommand


File "cmd_main.rst":

.. code:: rst

   Fancytool command
   ***********************

   .. argparse::
      :module: my.module
      :func: my_func_that_returns_a_parser
      :prog: fancytool

      subcommand
           Here we add a reference to subcommand, to simplify navigation.
           See :doc:`cmd_subcommand`


File "cmd_subcommand.rst":

.. code:: rst

   Subcommand command
   ***********************

   .. argparse::
      :module: my.module
      :func: my_func_that_return_parser
      :prog: fancytool
      :path: subcommand


Source of example file
----------------------

This file will be used in all generated examples.

.. literalinclude:: ../test/sample.py
   :language: python


Generated sample 1 - command with subcommands
---------------------------------------------

Directive
~~~~~~~~~

Source:

.. code:: rst

   .. argparse::
      :filename: ../test/sample.py
      :func: parser
      :prog: sample

Output
~~~~~~

.. argparse::
    :filename: ../test/sample.py
    :func: parser
    :prog: sample


Generated sample 2 - subcommand
-------------------------------

Directive
~~~~~~~~~

Source:

.. code:: rst

   .. argparse::
      :filename: ../test/sample.py
      :func: parser
      :prog: sample
      :path: game

Output
~~~~~~

.. argparse::
   :filename: ../test/sample.py
   :func: parser
   :prog: sample
   :path: game