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

Method onecmd

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

Interpret the argument as though it had been typed in response to the prompt. This may be overridden, but should not normally need to be; see the precmd() and postcmd() methods for useful execution hooks. The return value is a flag indicating whether interpretat

(self, line)

Source from the content-addressed store, hash-verified

190 return cmd, arg, line
191
192 def onecmd(self, line):
193 """Interpret the argument as though it had been typed in response
194 to the prompt.
195
196 This may be overridden, but should not normally need to be;
197 see the precmd() and postcmd() methods for useful execution hooks.
198 The return value is a flag indicating whether interpretation of
199 commands by the interpreter should stop.
200
201 """
202 cmd, arg, line = self.parseline(line)
203 if not line:
204 return self.emptyline()
205 if cmd is None:
206 return self.default(line)
207 self.lastcmd = line
208 if line == 'EOF' :
209 self.lastcmd = ''
210 if cmd == '':
211 return self.default(line)
212 else:
213 try:
214 func = getattr(self, 'do_' + cmd)
215 except AttributeError:
216 return self.default(line)
217 return func(arg)
218
219 def emptyline(self):
220 """Called when an empty line is entered in response to the prompt.

Callers 2

cmdloopMethod · 0.95
emptylineMethod · 0.95

Calls 3

parselineMethod · 0.95
emptylineMethod · 0.95
defaultMethod · 0.95

Tested by

no test coverage detected