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

Method do_help

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

List available commands with "help" or detailed help with "help cmd".

(self, arg)

Source from the content-addressed store, hash-verified

290 return list(commands | topics)
291
292 def do_help(self, arg):
293 'List available commands with "help" or detailed help with "help cmd".'
294 if arg:
295 # XXX check arg syntax
296 try:
297 func = getattr(self, 'help_' + arg)
298 except AttributeError:
299 try:
300 doc=getattr(self, 'do_' + arg).__doc__
301 if doc:
302 self.stdout.write("%s\n"%str(doc))
303 return
304 except AttributeError:
305 pass
306 self.stdout.write("%s\n"%str(self.nohelp % (arg,)))
307 return
308 func()
309 else:
310 names = self.get_names()
311 cmds_doc = []
312 cmds_undoc = []
313 topics = set()
314 for name in names:
315 if name[:5] == 'help_':
316 topics.add(name[5:])
317 names.sort()
318 # There can be duplicates if routines overridden
319 prevname = ''
320 for name in names:
321 if name[:3] == 'do_':
322 if name == prevname:
323 continue
324 prevname = name
325 cmd=name[3:]
326 if cmd in topics:
327 cmds_doc.append(cmd)
328 topics.remove(cmd)
329 elif getattr(self, name).__doc__:
330 cmds_doc.append(cmd)
331 else:
332 cmds_undoc.append(cmd)
333 self.stdout.write("%s\n"%str(self.doc_leader))
334 self.print_topics(self.doc_header, cmds_doc, 15,80)
335 self.print_topics(self.misc_header, sorted(topics),15,80)
336 self.print_topics(self.undoc_header, cmds_undoc, 15,80)
337
338 def print_topics(self, header, cmds, cmdlen, maxcol):
339 if cmds:

Callers

nothing calls this directly

Calls 10

get_namesMethod · 0.95
print_topicsMethod · 0.95
strFunction · 0.85
sortedFunction · 0.85
setFunction · 0.50
writeMethod · 0.45
addMethod · 0.45
sortMethod · 0.45
appendMethod · 0.45
removeMethod · 0.45

Tested by

no test coverage detected