Skip to content

Commit 3390948

Browse files
committed
Clarify comments for self.invalid_alias_pattern
1 parent 3343aad commit 3390948

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

cmd2/cmd2.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -731,14 +731,17 @@ def __init__(self, completekey='tab', stdin=None, stdout=None, persistent_histor
731731
self.broken_pipe_warning = ''
732732

733733
# regular expression to test for invalid characters in aliases
734+
# we will construct it dynamically, because some of the components
735+
# like terminator characters, can change
734736
invalid_items = []
735737
invalid_items.extend(constants.REDIRECTION_CHARS)
736738
invalid_items.extend(self.terminators)
737739
# escape each item so it will for sure get treated as a literal
738740
invalid_items = [re.escape(x) for x in invalid_items]
739741
# don't allow whitespace
740742
invalid_items.append(r'\s')
741-
# join them up with a pipe
743+
# join them up with a pipe to form a regular expression
744+
# that looks something like r';|>|\||\s'
742745
expr = '|'.join(invalid_items)
743746
# and compile it into a pattern
744747
self.invalid_alias_pattern = re.compile(expr)

0 commit comments

Comments
 (0)