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
|
Extending result of `argparse` directive
-----------------------------------------
You can add extra content or even replace some part of documentation generated by `argparse` directive.
For example, any content you put inside directive (follow reText identation rules), will be inserted, just before argument and option list::
.. argparse::
:module: my.module
:func: my_func_that_return_parser
:prog: fancytool
My content here that will be inserted as extra, right before argument list.
Also any valid markup...
*************************
... may `be` *applied* here
including::
any directives you usually use.
Also, there is an option to insert own content into argument/option/subcommand description. Just create definition-list,
where name is argument/option/subcommand name and definition-body is any reStructured markup::
.. argparse::
:module: my.module
:func: my_func_that_return_parser
:prog: fancytool
My content here that will be inserted as extra right before argument list.
foo
This text will go right after "foo" positional argument help.
install
This text will go right after "install" subcommand help and before it's arguments.
--upgrade
This text will go to upgrade option of install subcommand, nesting is not limited
You can also add classifiers to definition-list that will change behavior of content merge algorythm::
.. argparse::
:module: my.module
:func: my_func_that_return_parser
:prog: fancytool
My content that will be inserted as extra, right before argument list.
foo : @before
This text will go right after "foo" positional argument help.
install : @replace
This text will go right after "install" subcommand help and befor it's arguments.
--upgrade : @after
This text will go to upgrade option of install subcommand, nesting is not limited
@before
Insert content before parsed help message of argument/option/subcommand.
@after
Insert content after parsed help message of argument/option/subcommand.
This is default, if you do not specify classifier explicitly.
@replace
Replace content of help message of argument/option/subcommand.
|