comparison cmd2.py @ 74:4e290d75e92e

ugh, big new refactoring: split out UserCommand
author catherine@Elli.myhome.westell.com
date Wed, 25 Jun 2008 17:16:07 -0400
parents 101283b63e1b
children 8b2603d1acc1
comparison
equal deleted inserted replaced
73:101283b63e1b 74:4e290d75e92e
161 return result[0][0].strip(), result[0][1:-1], result[0][-1].strip() 161 return result[0][0].strip(), result[0][1:-1], result[0][-1].strip()
162 else: 162 else:
163 return None 163 return None
164 return parser 164 return parser
165 165
166 class UserCommand(str):
167 def __init__(self, s):
168 str.__init__(self, s)
169 self.executable = s
170 self.searchable = s
171
166 class Cmd(cmd.Cmd): 172 class Cmd(cmd.Cmd):
167 caseInsensitive = True 173 caseInsensitive = True
168 terminators = [';', pyparsing.LineEnd() + pyparsing.LineEnd()] 174 terminators = [';', pyparsing.LineEnd() + pyparsing.LineEnd()]
169 multilineCommands = [] # commands that need a terminator to be finished 175 multilineCommands = [] # commands that need a terminator to be finished
170 terminatorKeepingCommands = [] # commands that expect to process their own terminators (else it will be stripped during parse) 176 terminatorKeepingCommands = [] # commands that expect to process their own terminators (else it will be stripped during parse)