MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / parseline

Method parseline

tools/python-3.11.9-amd64/Lib/cmd.py:172–190  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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

Callers 3

onecmdMethod · 0.95
completeMethod · 0.95
handle_command_defMethod · 0.80

Calls 1

stripMethod · 0.80

Tested by

no test coverage detected