diff options
author | kotfu <kotfu@kotfu.net> | 2018-05-10 11:33:53 -0600 |
---|---|---|
committer | kotfu <kotfu@kotfu.net> | 2018-05-10 11:33:53 -0600 |
commit | ceb3ef56e5c98e3af31de27a2ce43b64324c7e4e (patch) | |
tree | 862840b5d797030374bc559ebdfed6465190eb08 /cmd2/cmd2.py | |
parent | ce5092fd9c2e23baa0952aac665e7c26ed85a03a (diff) | |
download | cmd2-git-ceb3ef56e5c98e3af31de27a2ce43b64324c7e4e.tar.gz |
Get rid of last hard-coded redirection constants
Diffstat (limited to 'cmd2/cmd2.py')
-rwxr-xr-x | cmd2/cmd2.py | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py index eb90c72e..43fd99ec 100755 --- a/cmd2/cmd2.py +++ b/cmd2/cmd2.py @@ -1148,29 +1148,26 @@ class Cmd(cmd.Cmd): if len(raw_tokens) > 1: - # Build a list of all redirection tokens - all_redirects = constants.REDIRECTION_CHARS + ['>>'] - # Check if there are redirection strings prior to the token being completed seen_pipe = False has_redirection = False for cur_token in raw_tokens[:-1]: - if cur_token in all_redirects: + if cur_token in constants.REDIRECTION_TOKENS: has_redirection = True - if cur_token == '|': + if cur_token == constants.REDIRECTION_PIPE: seen_pipe = True # Get token prior to the one being completed prior_token = raw_tokens[-2] # If a pipe is right before the token being completed, complete a shell command as the piped process - if prior_token == '|': + if prior_token == constants.REDIRECTION_PIPE: return self.shell_cmd_complete(text, line, begidx, endidx) # Otherwise do path completion either as files to redirectors or arguments to the piped process - elif prior_token in all_redirects or seen_pipe: + elif prior_token in constants.REDIRECTION_TOKENS or seen_pipe: return self.path_complete(text, line, begidx, endidx) # If there were redirection strings anywhere on the command line, then we |