summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkotfu <kotfu@kotfu.net>2018-04-29 19:09:20 -0600
committerkotfu <kotfu@kotfu.net>2018-04-29 19:09:20 -0600
commit4b903e0cc868a5410691f7c655efbad9d427124f (patch)
tree2f178b4b0a59b1296594d4efc69d44de24159cf0
parenteecdc5cd3e155e21b65c7e87c4b82832d5232430 (diff)
downloadcmd2-git-4b903e0cc868a5410691f7c655efbad9d427124f.tar.gz
Add some documentation
-rw-r--r--cmd2/parsing.py30
1 files changed, 29 insertions, 1 deletions
diff --git a/cmd2/parsing.py b/cmd2/parsing.py
index c1795f33..3c56bcc6 100644
--- a/cmd2/parsing.py
+++ b/cmd2/parsing.py
@@ -28,6 +28,31 @@ class Statement(str):
The string portion of the class contains the arguments, but not the command, nor
the output redirection clauses.
+
+ :var raw: string containing exactly what we input by the user
+ :type raw: str
+ :var command: the command, i.e. the first whitespace delimited word
+ :type command: str or None
+ :var multiline_command: if the command is a multiline command, the name of the
+ command, otherwise None
+ :type command: str or None
+ :var args: the arguments to the command, not including any output
+ redirection or terminators. quoted arguments remain
+ quoted.
+ :type args: str
+ :var terminator: the charater which terminated the multiline command, if
+ there was one
+ :type terminator: str or None
+ :var suffix: characters appearing after the terminator but before output
+ redirection, if any
+ :type suffix: str or None
+ :var pipe_to: if output was piped to a shell command, the shell command
+ :type pipe_to: str or None
+ :var output: if output was redirected, the redirection token, i.e. '>>'
+ :type output: str or None
+ :var output_to: if output was redirected, the destination, usually a filename
+ :type output_to: str or None
+
"""
def __init__(self, obj):
super().__init__()
@@ -44,7 +69,10 @@ class Statement(str):
@property
def command_and_args(self):
- """Combine command and args with a space separating them"""
+ """Combine command and args with a space separating them.
+
+ Quoted arguments remain quoted.
+ """
return '{} {}'.format('' if self.command is None else self.command, self.args).strip()
class StatementParser():