Parse the line into a command name and a string containing the arguments. Returns a tuple containing (command, args, line). 'command' and 'args' may be None if the line couldn't be parsed.
(self, line)
| 170 | pass |
| 171 | |
| 172 | def parseline(self, line): |
| 173 | """Parse the line into a command name and a string containing |
| 174 | the arguments. Returns a tuple containing (command, args, line). |
| 175 | 'command' and 'args' may be None if the line couldn't be parsed. |
| 176 | """ |
| 177 | line = line.strip() |
| 178 | if not line: |
| 179 | return None, None, line |
| 180 | elif line[0] == '?': |
| 181 | line = 'help ' + line[1:] |
| 182 | elif line[0] == '!': |
| 183 | if hasattr(self, 'do_shell'): |
| 184 | line = 'shell ' + line[1:] |
| 185 | else: |
| 186 | return None, None, line |
| 187 | i, n = 0, len(line) |
| 188 | while i < n and line[i] in self.identchars: i = i+1 |
| 189 | cmd, arg = line[:i], line[i:].strip() |
| 190 | return cmd, arg, line |
| 191 | |
| 192 | def onecmd(self, line): |
| 193 | """Interpret the argument as though it had been typed in response |
no test coverage detected