##// 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 33 extensions,
34 34 fancyopts,
35 35 fileset,
36 help,
36 37 hg,
37 38 hook,
38 39 profiling,
@@ -242,19 +243,24 b' def callcatch(ui, func):'
242 243 _formatparse(ui.warn, inst)
243 244 return -1
244 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 247 try:
247 248 # check if the command is in a disabled extension
248 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 253 except (error.UnknownCommand, error.Abort):
251 254 suggested = False
252 255 if len(inst.args) == 2:
253 256 sim = _getsimilar(inst.args[1], inst.args[0])
254 257 if sim:
258 ui.warn(nocmdmsg)
255 259 _reportsimilar(ui.warn, sim)
256 260 suggested = True
257 261 if not suggested:
262 ui.pager('help')
263 ui.warn(nocmdmsg)
258 264 commands.help_(ui, 'shortlist')
259 265 except IOError:
260 266 raise
General Comments 0
You need to be logged in to leave comments. Login now