diff mercurial/commands.py @ 17837:b623e323c561

help: indicate help omitting if help document is not fully displayed Before this patch, there is no information about whether help document is fully displayed or not. So, some users seem to misunderstand "-v" for "hg help" just as "the option to show list of global options": experience on "hg help -v" for some commands not containing verbose containers may strengthen this misunderstanding. Such users have less opportunity for noticing omitted help document, and this may cause insufficient understanding about Mercurial. This patch indicates help omitting, if help document is not fully displayed. For command help, the message below is displayed at the end of help output, if help document is not fully displayed: use "hg -v help xxxx" to show more complete help and the global options and otherwise: use "hg -v help xxxx" to show the global options For topics and extensions help, the message below is displayed, only if help document is not fully displayed: use "hg help -v xxxx" to show more complete help This allows users to know whether there is any omitted information or not exactly, and can trigger "hg help -v" invocation. This patch causes formatting help document twice, to switch messages one for omitted help, and another for not omitted. This decreases performance of help document formatting, but it is not mainly focused at help command invocation, so this wouldn't become problem.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Thu, 18 Oct 2012 10:31:15 +0900
parents 1cb51d65453d
children 66f0c78350ab
line wrap: on
line diff
--- a/mercurial/commands.py	Thu Oct 18 23:55:15 2012 -0500
+++ b/mercurial/commands.py	Thu Oct 18 10:31:15 2012 +0900
@@ -3265,8 +3265,12 @@
                 rst.append(_('\nuse "hg help %s" to show the full help text\n')
                            % name)
             elif not ui.quiet:
-                rst.append(_('\nuse "hg -v help %s" to show more info\n')
-                           % name)
+                omitted = _('use "hg -v help %s" to show more complete'
+                            ' help and the global options') % name
+                notomitted = _('use "hg -v help %s" to show'
+                               ' the global options') % name
+                help.indicateomitted(rst, omitted, notomitted)
+
         return rst
 
 
@@ -3369,6 +3373,11 @@
         if util.safehasattr(doc, '__call__'):
             rst += ["    %s\n" % l for l in doc().splitlines()]
 
+        if not ui.verbose:
+            omitted = (_('use "hg help -v %s" to show more complete help') %
+                       name)
+            help.indicateomitted(rst, omitted)
+
         try:
             cmdutil.findcmd(name, table)
             rst.append(_('\nuse "hg help -c %s" to see help for '
@@ -3396,6 +3405,11 @@
             rst.extend(tail.splitlines(True))
             rst.append('\n')
 
+        if not ui.verbose:
+            omitted = (_('use "hg help -v %s" to show more complete help') %
+                       name)
+            help.indicateomitted(rst, omitted)
+
         if mod:
             try:
                 ct = mod.cmdtable
@@ -3459,7 +3473,13 @@
         rst.extend(helplist())
 
     keep = ui.verbose and ['verbose'] or []
-    formatted, pruned = minirst.format(''.join(rst), textwidth, keep=keep)
+    text = ''.join(rst)
+    formatted, pruned = minirst.format(text, textwidth, keep=keep)
+    if 'verbose' in pruned:
+        keep.append('omitted')
+    else:
+        keep.append('notomitted')
+    formatted, pruned = minirst.format(text, textwidth, keep=keep)
     ui.write(formatted)