mercurial/commands.py
changeset 16782 ba512212dab1
parent 16781 c0b98f436cce
child 16783 bb446969efd4
equal deleted inserted replaced
16781:c0b98f436cce 16782:ba512212dab1
  3087     Returns 0 if successful.
  3087     Returns 0 if successful.
  3088     """
  3088     """
  3089 
  3089 
  3090     textwidth = min(ui.termwidth(), 80) - 2
  3090     textwidth = min(ui.termwidth(), 80) - 2
  3091 
  3091 
  3092     def addglobalopts(optlist, aliases):
  3092     def addglobalopts(optlist):
  3093         if ui.quiet:
  3093         if ui.quiet:
  3094             return []
  3094             return []
  3095 
  3095 
  3096         if ui.verbose:
  3096         if ui.verbose:
  3097             optlist.append((_("global options:"), globalopts))
  3097             optlist.append((_("global options:"), globalopts))
  3102             if name == 'shortlist':
  3102             if name == 'shortlist':
  3103                 msg = _('use "hg help" for the full list of commands '
  3103                 msg = _('use "hg help" for the full list of commands '
  3104                         'or "hg -v" for details')
  3104                         'or "hg -v" for details')
  3105             elif name and not full:
  3105             elif name and not full:
  3106                 msg = _('use "hg help %s" to show the full help text') % name
  3106                 msg = _('use "hg help %s" to show the full help text') % name
  3107             elif aliases:
  3107             else:
  3108                 msg = _('use "hg -v help%s" to show builtin aliases and '
  3108                 msg = _('use "hg -v help%s" to show builtin aliases and '
  3109                         'global options') % (name and " " + name or "")
  3109                         'global options') % (name and " " + name or "")
  3110             else:
       
  3111                 msg = _('use "hg -v help %s" to show more info') % name
       
  3112             optlist.append((msg, ()))
  3110             optlist.append((msg, ()))
  3113 
  3111 
  3114     def helpcmd(name):
  3112     def helpcmd(name):
  3115         try:
  3113         try:
  3116             aliases, entry = cmdutil.findcmd(name, table, strict=unknowncmd)
  3114             aliases, entry = cmdutil.findcmd(name, table, strict=unknowncmd)
  3251             topics_len = max([len(s[0]) for s in topics])
  3249             topics_len = max([len(s[0]) for s in topics])
  3252             for t, desc in topics:
  3250             for t, desc in topics:
  3253                 ui.write(" %-*s   %s\n" % (topics_len, t, desc))
  3251                 ui.write(" %-*s   %s\n" % (topics_len, t, desc))
  3254 
  3252 
  3255         optlist = []
  3253         optlist = []
  3256         addglobalopts(optlist, True)
  3254         addglobalopts(optlist)
  3257         ui.write(help.opttext(optlist, textwidth, ui.verbose))
  3255         ui.write(help.opttext(optlist, textwidth, ui.verbose))
  3258 
  3256 
  3259     def helptopic(name):
  3257     def helptopic(name):
  3260         for names, header, doc in help.helptable:
  3258         for names, header, doc in help.helptable:
  3261             if name in names:
  3259             if name in names: