pager: provide a default attend list
authorBrodie Rao <me+hg@dackz.net>
Thu, 12 Nov 2009 10:29:40 -0500
changeset 9841 7cd6dee6fe37
parent 9840 18d5935c0c62
child 9842 d3dbdca92458
pager: provide a default attend list The default list includes commands which normally print large amounts of text. This should be more user-friendly than paging all commands by default, which can be confusing when the pager swallows input prompts (with, e.g., record, merge, HTTP/SSH authentication, etc.)
hgext/pager.py
--- a/hgext/pager.py	Thu Nov 12 12:46:00 2009 +0100
+++ b/hgext/pager.py	Thu Nov 12 10:29:40 2009 -0500
@@ -35,10 +35,13 @@
   ignore = version, help, update
 
 You can also enable the pager only for certain commands using
-pager.attend::
+pager.attend. Below is the default list of commands to be paged::
 
   [pager]
-  attend = log
+  attend = annotate, cat, diff, export, glog, log, qdiff
+
+Setting pager.attend to an empty value will cause all commands to be
+paged.
 
 If pager.attend is present, pager.ignore will be ignored.
 
@@ -53,7 +56,7 @@
     def pagecmd(orig, ui, options, cmd, cmdfunc):
         p = ui.config("pager", "pager", os.environ.get("PAGER"))
         if p and sys.stdout.isatty() and '--debugger' not in sys.argv:
-            attend = ui.configlist('pager', 'attend')
+            attend = ui.configlist('pager', 'attend', attended)
             if (cmd in attend or
                 (cmd not in ui.configlist('pager', 'ignore') and not attend)):
                 sys.stderr = sys.stdout = util.popen(p, "wb")
@@ -62,3 +65,5 @@
         return orig(ui, options, cmd, cmdfunc)
 
     extensions.wrapfunction(dispatch, '_runcommand', pagecmd)
+
+attended = ['annotate', 'cat', 'diff', 'export', 'glog', 'log', 'qdiff']