##// END OF EJS Templates
dispatch: rearrange 'unknown command' code to better employ pager...
Augie Fackler -
r31060:ab20491b default
parent child Browse files
Show More
@@ -33,6 +33,7 b' from . import ('
33 extensions,
33 extensions,
34 fancyopts,
34 fancyopts,
35 fileset,
35 fileset,
36 help,
36 hg,
37 hg,
37 hook,
38 hook,
38 profiling,
39 profiling,
@@ -242,19 +243,24 b' def callcatch(ui, func):'
242 _formatparse(ui.warn, inst)
243 _formatparse(ui.warn, inst)
243 return -1
244 return -1
244 except error.UnknownCommand as inst:
245 except error.UnknownCommand as inst:
245 ui.warn(_("hg: unknown command '%s'\n") % inst.args[0])
246 nocmdmsg = _("hg: unknown command '%s'\n") % inst.args[0]
246 try:
247 try:
247 # check if the command is in a disabled extension
248 # check if the command is in a disabled extension
248 # (but don't check for extensions themselves)
249 # (but don't check for extensions themselves)
249 commands.help_(ui, inst.args[0], unknowncmd=True)
250 formatted = help.formattedhelp(ui, inst.args[0], unknowncmd=True)
251 ui.warn(nocmdmsg)
252 ui.write(formatted)
250 except (error.UnknownCommand, error.Abort):
253 except (error.UnknownCommand, error.Abort):
251 suggested = False
254 suggested = False
252 if len(inst.args) == 2:
255 if len(inst.args) == 2:
253 sim = _getsimilar(inst.args[1], inst.args[0])
256 sim = _getsimilar(inst.args[1], inst.args[0])
254 if sim:
257 if sim:
258 ui.warn(nocmdmsg)
255 _reportsimilar(ui.warn, sim)
259 _reportsimilar(ui.warn, sim)
256 suggested = True
260 suggested = True
257 if not suggested:
261 if not suggested:
262 ui.pager('help')
263 ui.warn(nocmdmsg)
258 commands.help_(ui, 'shortlist')
264 commands.help_(ui, 'shortlist')
259 except IOError:
265 except IOError:
260 raise
266 raise
General Comments 0
You need to be logged in to leave comments. Login now