Mercurial > python-cmd2
comparison cmd2.py @ 191:9d9e9ea88daf
drop unused code
author | catherine@Elli.myhome.westell.com |
---|---|
date | Thu, 12 Feb 2009 04:29:43 -0500 |
parents | 51c15fe803a4 |
children | c0d4c7ba14a9 |
comparison
equal
deleted
inserted
replaced
190:51c15fe803a4 | 191:9d9e9ea88daf |
---|---|
151 raise OSError, pastebufferr % ('xclip', 'On Debian/Ubuntu, install with "sudo apt-get install xclip"') | 151 raise OSError, pastebufferr % ('xclip', 'On Debian/Ubuntu, install with "sudo apt-get install xclip"') |
152 setPasteBuffer = getPasteBuffer | 152 setPasteBuffer = getPasteBuffer |
153 writeToPasteBuffer = getPasteBuffer | 153 writeToPasteBuffer = getPasteBuffer |
154 | 154 |
155 pyparsing.ParserElement.setDefaultWhitespaceChars(' \t') | 155 pyparsing.ParserElement.setDefaultWhitespaceChars(' \t') |
156 ''' | |
157 def parseSearchResults(pattern, s): | |
158 generator = pattern.scanString(s) | |
159 try: | |
160 result, start, stop = generator.next() | |
161 result['before'], result['after'] = s[:start], s[stop:] | |
162 result['upToIncluding'] = s[:stop] | |
163 except StopIteration: | |
164 result = pyparsing.ParseResults('') | |
165 result['before'] = s | |
166 return result | |
167 ''' | |
168 | |
169 def replaceInput(source): | |
170 if source: | |
171 newinput = open(source[0], 'r').read() | |
172 else: | |
173 newinput = getPasteBuffer() | |
174 | |
175 try: | |
176 if statement.inputFrom: | |
177 newinput = open(statement.inputFrom, 'r').read() | |
178 else: | |
179 newinput = getPasteBuffer() | |
180 except (OSError,), e: | |
181 print e | |
182 return 0 | |
183 start, end = self.redirectInPattern.scanString(statement.fullStatement).next()[1:] | |
184 return self.onecmd('%s%s%s' % (statement.fullStatement[:start], | |
185 newinput, statement.fullStatement[end:])) | |
186 | 156 |
187 class ParsedString(str): | 157 class ParsedString(str): |
188 pass | 158 pass |
189 | 159 |
190 class Cmd(cmd.Cmd): | 160 class Cmd(cmd.Cmd): |