summaryrefslogtreecommitdiff
path: root/cmd2/parsing.py
diff options
context:
space:
mode:
Diffstat (limited to 'cmd2/parsing.py')
-rw-r--r--cmd2/parsing.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/cmd2/parsing.py b/cmd2/parsing.py
index b67cef10..67e97c2b 100644
--- a/cmd2/parsing.py
+++ b/cmd2/parsing.py
@@ -5,7 +5,7 @@
import os
import re
import shlex
-from typing import List, Tuple, Dict
+from typing import List, Tuple, Dict, Union
from . import constants
from . import utils
@@ -105,6 +105,17 @@ class Statement(str):
rtn = None
return rtn
+ @property
+ def arg_list(self) -> Union[List[str], None]:
+ """
+ Returns a list of the arguments to the command, not including any output
+ redirection or terminators. quoted arguments remain quoted.
+ """
+ if self.args is None:
+ return None
+
+ return self.args.split()
+
def __setattr__(self, name, value):
"""Statement instances should feel immutable; raise ValueError"""
raise ValueError