327 """list all available commands and options""" |
327 """list all available commands and options""" |
328 for cmd, vals in sorted(commands.table.iteritems()): |
328 for cmd, vals in sorted(commands.table.iteritems()): |
329 cmd = cmd.split('|')[0].strip('^') |
329 cmd = cmd.split('|')[0].strip('^') |
330 opts = ', '.join([i[1] for i in vals[1]]) |
330 opts = ', '.join([i[1] for i in vals[1]]) |
331 ui.write('%s: %s\n' % (cmd, opts)) |
331 ui.write('%s: %s\n' % (cmd, opts)) |
|
332 |
|
333 @command('debugcomplete', |
|
334 [('o', 'options', None, _('show the command options'))], |
|
335 _('[-o] CMD'), |
|
336 norepo=True) |
|
337 def debugcomplete(ui, cmd='', **opts): |
|
338 """returns the completion list associated with the given command""" |
|
339 |
|
340 if opts.get('options'): |
|
341 options = [] |
|
342 otables = [commands.globalopts] |
|
343 if cmd: |
|
344 aliases, entry = cmdutil.findcmd(cmd, commands.table, False) |
|
345 otables.append(entry[1]) |
|
346 for t in otables: |
|
347 for o in t: |
|
348 if "(DEPRECATED)" in o[3]: |
|
349 continue |
|
350 if o[0]: |
|
351 options.append('-%s' % o[0]) |
|
352 options.append('--%s' % o[1]) |
|
353 ui.write("%s\n" % "\n".join(options)) |
|
354 return |
|
355 |
|
356 cmdlist, unused_allcmds = cmdutil.findpossible(cmd, commands.table) |
|
357 if ui.verbose: |
|
358 cmdlist = [' '.join(c[0]) for c in cmdlist.values()] |
|
359 ui.write("%s\n" % "\n".join(sorted(cmdlist))) |