Mercurial > public > mercurial-scm > hg-stable
diff mercurial/commands.py @ 7880:7ca2be800804
add debugcommands command: an easy to parse command + option index
author | Dirkjan Ochtman <dirkjan@ochtman.nl> |
---|---|
date | Mon, 23 Mar 2009 13:43:48 +0100 |
parents | 553aa0cbeab6 |
children | 553cef16031f |
line wrap: on
line diff
--- a/mercurial/commands.py Mon Mar 23 10:41:42 2009 +0100 +++ b/mercurial/commands.py Mon Mar 23 13:43:48 2009 +0100 @@ -683,6 +683,12 @@ a = r.ancestor(lookup(rev1), lookup(rev2)) ui.write("%d:%s\n" % (r.rev(a), hex(a))) +def debugcommands(ui, cmd='', *args): + for cmd, vals in util.sort(table.iteritems()): + cmd = cmd.split('|')[0].strip('^') + opts = ', '.join([i[1] for i in vals[1]]) + ui.write('%s: %s\n' % (cmd, opts)) + def debugcomplete(ui, cmd='', **opts): """returns the completion list associated with the given command""" @@ -3134,6 +3140,7 @@ _('[OPTION]... [SOURCE]... DEST')), "debugancestor": (debugancestor, [], _('[INDEX] REV1 REV2')), "debugcheckstate": (debugcheckstate, []), + "debugcommands": (debugcommands, [], _('[COMMAND]')), "debugcomplete": (debugcomplete, [('o', 'options', None, _('show the command options'))], @@ -3416,6 +3423,6 @@ "version": (version_, []), } -norepo = ("clone init version help debugcomplete debugdata" +norepo = ("clone init version help debugcommands debugcomplete debugdata" " debugindex debugindexdot debugdate debuginstall debugfsinfo") optionalrepo = ("identify paths serve showconfig debugancestor")