summaryrefslogtreecommitdiff
path: root/docs/api
diff options
context:
space:
mode:
authorkotfu <kotfu@kotfu.net>2020-02-14 22:27:59 -0700
committerkotfu <kotfu@kotfu.net>2020-02-14 22:27:59 -0700
commit1e1480507108271a2ba77e1a469582c8944e2c60 (patch)
tree53001c6892855f476ddc48fdd363ac0b69d15152 /docs/api
parent51c831d2f28609c736a0d649b04e7d2e3b3d742a (diff)
downloadcmd2-git-1e1480507108271a2ba77e1a469582c8944e2c60.tar.gz
Add documentation for parsing classes
Diffstat (limited to 'docs/api')
-rw-r--r--docs/api/decorators.rst9
-rw-r--r--docs/api/index.rst1
-rw-r--r--docs/api/parsing.rst45
3 files changed, 48 insertions, 7 deletions
diff --git a/docs/api/decorators.rst b/docs/api/decorators.rst
index e5ca4c7e..c78dcc66 100644
--- a/docs/api/decorators.rst
+++ b/docs/api/decorators.rst
@@ -1,10 +1,5 @@
cmd2.decorators
===============
-.. autofunction:: cmd2.decorators.with_argparser
-
-.. autofunction:: cmd2.decorators.with_argparser_and_unknown_args
-
-.. autofunction:: cmd2.decorators.with_argument_list
-
-.. autofunction:: cmd2.decorators.with_category
+.. automodule:: cmd2.decorators
+ :members:
diff --git a/docs/api/index.rst b/docs/api/index.rst
index 4781a249..667348be 100644
--- a/docs/api/index.rst
+++ b/docs/api/index.rst
@@ -5,6 +5,7 @@ API Reference
:maxdepth: 1
cmd
+ parsing
decorators
exceptions
ansi
diff --git a/docs/api/parsing.rst b/docs/api/parsing.rst
new file mode 100644
index 00000000..dd800eed
--- /dev/null
+++ b/docs/api/parsing.rst
@@ -0,0 +1,45 @@
+cmd2.parsing
+===============
+
+.. autoclass:: cmd2.Statement
+ :members:
+
+ .. attribute:: command
+
+ The name of the command after shortcuts and macros have been expanded
+
+ .. attribute:: args
+
+ The arguments to the command as a string with spaces between the words,
+ excluding output redirection and command terminators. If the user used
+ quotes in their input, they remain here, and you will have to handle them
+ on your own.
+
+ .. attribute:: arg_list
+
+ The arguments to the command as a list, excluding output
+ redirection and command terminators. Each argument is represented as an
+ element in the list. Quoted arguments remain quoted. If you want to
+ remove the quotes, use :func:`cmd2.utils.strip_quotes` or use
+ ``argv[1:]``
+
+ .. attribute:: raw
+
+ If you want full access to exactly what the user typed at the input
+ prompt you can get it, but you'll have to parse it on your own,
+ including:
+
+ - shortcuts and aliases
+ - quoted commands and arguments
+ - output redirection
+ - multi-line command terminator handling
+
+ If you use multiline commands, all the input will be passed to you in
+ this string, but there will be embedded newlines where the user hit
+ return to continue the command on the next line.
+
+
+.. autoclass:: cmd2.parsing.StatementParser
+ :members:
+
+ .. automethod:: __init__