~benoit.pierre/bzrtools/shell_improvements

« back to all changes in this revision

Viewing changes to shell.py

  • Committer: Benoît Pierre
  • Date: 2008-11-30 16:42:56 UTC
  • Revision ID: benoit.pierre@gmail.com-20081130164256-qghad5emhb6dy69z
Factorize code in shell to use the same set of chars to detect complex
command line.

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
 
37
37
SHELL_BLACKLIST = set(['rm', 'ls'])
38
38
COMPLETION_BLACKLIST = set(['shell'])
 
39
COMPLEX_COMMAND_CHARS = ('|', '<', '>', '&', '*', '?')
39
40
 
40
41
 
41
42
class BlackListedCommand(BzrError):
329
330
 
330
331
 
331
332
def too_complicated(line):
332
 
    for char in '|<>*?':
 
333
    for char in COMPLEX_COMMAND_CHARS:
333
334
        if char in line:
334
335
            return True
335
336
    return False