Changeset 3bf35bb9c157…
Parent bc6db3c5bbf3…
by
Changes to 2 files · Browse files at 3bf35bb9c157 Showing diff from parent bc6db3c5bbf3 Diff from another changeset...
@@ -62,7 +62,7 @@ if [[ -z "$cmd" ]]
then
_arguments -s -w : $_hg_global_opts \
- ':mercurial command:_hg_commands'
+ ':hgtk command:_hg_commands'
return
fi
@@ -118,7 +118,7 @@ typeset -gA _hg_alias_list
local hline cmd cmdalias
- _call_program hg hg debugcomplete -v 2>/dev/null | while read -A hline
+ _call_program hgtk hgtk debugcomplete -v 2>/dev/null | while read -A hline
do
cmd=$hline[1]
_hg_cmd_list+=($cmd)
|
@@ -28,7 +28,7 @@ import sys
import traceback
-nonrepo_commands = 'userconfig clone init about help version'
+nonrepo_commands = 'userconfig clone debugcomplete init about help version'
def dispatch(args):
"run the command specified in args"
@@ -492,6 +492,27 @@ if not ui.quiet:
ui.write(shortlicense)
+def debugcomplete(ui, cmd='', **opts):
+ """output list of possible commands"""
+ if opts.get('options'):
+ options = []
+ otables = [globalopts]
+ if cmd:
+ aliases, entry = cmdutil.findcmd(cmd, table, False)
+ otables.append(entry[1])
+ for t in otables:
+ for o in t:
+ if o[0]:
+ options.append('-%s' % o[0])
+ options.append('--%s' % o[1])
+ ui.write("%s\n" % "\n".join(options))
+ return
+
+ cmdlist = cmdutil.findpossible(cmd, table)
+ if ui.verbose:
+ cmdlist = [' '.join(c[0]) for c in cmdlist.values()]
+ ui.write("%s\n" % "\n".join(util.sort(cmdlist)))
+
globalopts = [
('R', 'repository', '',
_('repository root directory or symbolic path name')),
@@ -533,6 +554,9 @@ "^version": (version,
[('v', 'verbose', None, _('print license'))],
_('hgtk version [OPTION]')),
+ "debugcomplete": (debugcomplete,
+ [('o', 'options', None, _('show the command options'))],
+ _('[-o] CMD')),
"help": (help_, [], _('hgtk help [COMMAND]')),
}
|
Loading...