##// END OF EJS Templates
pager: use reST syntax for literal blocks
Martin Geisler -
r9212:dfc1d5da default
parent child Browse files
Show More
@@ -1,62 +1,62 b''
1 # pager.py - display output using a pager
1 # pager.py - display output using a pager
2 #
2 #
3 # Copyright 2008 David Soria Parra <dsp@php.net>
3 # Copyright 2008 David Soria Parra <dsp@php.net>
4 #
4 #
5 # This software may be used and distributed according to the terms of the
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2, incorporated herein by reference.
6 # GNU General Public License version 2, incorporated herein by reference.
7 #
7 #
8 # To load the extension, add it to your .hgrc file:
8 # To load the extension, add it to your .hgrc file:
9 #
9 #
10 # [extension]
10 # [extension]
11 # hgext.pager =
11 # hgext.pager =
12 #
12 #
13 # Run "hg help pager" to get info on configuration.
13 # Run "hg help pager" to get info on configuration.
14
14
15 '''browse command output with an external pager
15 '''browse command output with an external pager
16
16
17 To set the pager that should be used, set the application variable:
17 To set the pager that should be used, set the application variable::
18
18
19 [pager]
19 [pager]
20 pager = LESS='FSRX' less
20 pager = LESS='FSRX' less
21
21
22 If no pager is set, the pager extensions uses the environment variable $PAGER.
22 If no pager is set, the pager extensions uses the environment variable $PAGER.
23 If neither pager.pager, nor $PAGER is set, no pager is used.
23 If neither pager.pager, nor $PAGER is set, no pager is used.
24
24
25 If you notice "BROKEN PIPE" error messages, you can disable them by setting:
25 If you notice "BROKEN PIPE" error messages, you can disable them by setting::
26
26
27 [pager]
27 [pager]
28 quiet = True
28 quiet = True
29
29
30 You can disable the pager for certain commands by adding them to the
30 You can disable the pager for certain commands by adding them to the
31 pager.ignore list:
31 pager.ignore list::
32
32
33 [pager]
33 [pager]
34 ignore = version, help, update
34 ignore = version, help, update
35
35
36 You can also enable the pager only for certain commands using pager.attend:
36 You can also enable the pager only for certain commands using pager.attend::
37
37
38 [pager]
38 [pager]
39 attend = log
39 attend = log
40
40
41 If pager.attend is present, pager.ignore will be ignored.
41 If pager.attend is present, pager.ignore will be ignored.
42
42
43 To ignore global commands like "hg version" or "hg help", you have to specify
43 To ignore global commands like "hg version" or "hg help", you have to specify
44 them in the global .hgrc
44 them in the global .hgrc
45 '''
45 '''
46
46
47 import sys, os, signal
47 import sys, os, signal
48 from mercurial import dispatch, util, extensions
48 from mercurial import dispatch, util, extensions
49
49
50 def uisetup(ui):
50 def uisetup(ui):
51 def pagecmd(orig, ui, options, cmd, cmdfunc):
51 def pagecmd(orig, ui, options, cmd, cmdfunc):
52 p = ui.config("pager", "pager", os.environ.get("PAGER"))
52 p = ui.config("pager", "pager", os.environ.get("PAGER"))
53 if p and sys.stdout.isatty() and '--debugger' not in sys.argv:
53 if p and sys.stdout.isatty() and '--debugger' not in sys.argv:
54 attend = ui.configlist('pager', 'attend')
54 attend = ui.configlist('pager', 'attend')
55 if (cmd in attend or
55 if (cmd in attend or
56 (cmd not in ui.configlist('pager', 'ignore') and not attend)):
56 (cmd not in ui.configlist('pager', 'ignore') and not attend)):
57 sys.stderr = sys.stdout = util.popen(p, "wb")
57 sys.stderr = sys.stdout = util.popen(p, "wb")
58 if ui.configbool('pager', 'quiet'):
58 if ui.configbool('pager', 'quiet'):
59 signal.signal(signal.SIGPIPE, signal.SIG_DFL)
59 signal.signal(signal.SIGPIPE, signal.SIG_DFL)
60 return orig(ui, options, cmd, cmdfunc)
60 return orig(ui, options, cmd, cmdfunc)
61
61
62 extensions.wrapfunction(dispatch, '_runcommand', pagecmd)
62 extensions.wrapfunction(dispatch, '_runcommand', pagecmd)
General Comments 0
You need to be logged in to leave comments. Login now