diff options
author | kotfu <kotfu@kotfu.net> | 2018-05-06 10:20:34 -0600 |
---|---|---|
committer | kotfu <kotfu@kotfu.net> | 2018-05-06 10:20:34 -0600 |
commit | 339094832f9160e1961f4f95c4dc684413ab84c5 (patch) | |
tree | 8a205d3f4b851c300d9a82eff8136a24ce64a005 | |
parent | 3343aad02757739fd7ddb91b095db277a59574d9 (diff) | |
download | cmd2-git-339094832f9160e1961f4f95c4dc684413ab84c5.tar.gz |
Clarify comments for self.invalid_alias_pattern
-rwxr-xr-x | cmd2/cmd2.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py index 5c82e953..764f3ce7 100755 --- a/cmd2/cmd2.py +++ b/cmd2/cmd2.py @@ -731,6 +731,8 @@ class Cmd(cmd.Cmd): self.broken_pipe_warning = '' # regular expression to test for invalid characters in aliases + # we will construct it dynamically, because some of the components + # like terminator characters, can change invalid_items = [] invalid_items.extend(constants.REDIRECTION_CHARS) invalid_items.extend(self.terminators) @@ -738,7 +740,8 @@ class Cmd(cmd.Cmd): invalid_items = [re.escape(x) for x in invalid_items] # don't allow whitespace invalid_items.append(r'\s') - # join them up with a pipe + # join them up with a pipe to form a regular expression + # that looks something like r';|>|\||\s' expr = '|'.join(invalid_items) # and compile it into a pattern self.invalid_alias_pattern = re.compile(expr) |