Skip to content

Commit 646497f

Browse files
committed
Add short form option '-p' for '--paginate'
Fixes #593 Signed-off-by: Xavier Delaruelle <xavier.delaruelle@cea.fr>
1 parent 0e6b60a commit 646497f

File tree

11 files changed

+31
-12
lines changed

11 files changed

+31
-12
lines changed

NEWS.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ Modules 5.7.0 (not yet released)
5454
:instopt:`--disable-compressed-changelog<--enable-compressed-changelog>` to
5555
cope with packaging process handling documentation file compression at their
5656
level. (fix issue #592)
57+
* Add :option:`-p` option as an abbreviated form for :option:`--paginate`.
58+
(fix issue #593)
5759

5860

5961
.. _5.6 release notes:

doc/source/changes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -845,6 +845,8 @@ The following command line switches appeared on Modules 5.
845845
+------------+-----------------------------------------------------------------+
846846
| 5.6 | :option:`--dumpname` |
847847
+------------+-----------------------------------------------------------------+
848+
| 5.7 | :option:`-p` |
849+
+------------+-----------------------------------------------------------------+
848850

849851
:option:`--output`
850852

doc/source/module.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ switches are accepted:
541541
Elements *provided-alias* and *via* added for :subcmd:`avail` and
542542
:subcmd:`spider` sub-commands
543543

544-
.. option:: --paginate
544+
.. option:: --paginate, -p
545545

546546
Pipe all message output into :command:`less` (or if set, to the command
547547
referred in :envvar:`MODULES_PAGER` variable) if error output stream is a
@@ -551,6 +551,9 @@ switches are accepted:
551551

552552
.. versionadded:: 4.1
553553

554+
.. versionchanged:: 5.7
555+
Short form option :option:`-p` added
556+
554557
.. option:: --redirect
555558

556559
Send message output to stdout instead of stderr. Only supported on sh, bash,

init/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ endif
120120
# define variables for shell completion
121121
comp_cmds := add add-any apropos aliases avail append-path cachebuild cacheclear clear config del describe disable display edit help initadd initclear initlist initprepend initrm is-loaded is-saved is-used is-avail info-loaded keyword lint list load load-any mod-to-sh path paths purge prepend-path refresh reload reset restore rm remove remove-path save savelist saveshow saverm search show sh-to-mod source spider stash stashclear stashlist stashpop stashrm stashshow state swap switch test try-add try-load unload unuse update use whatis
122122
comp_long_opts := --debug --dumpname --help --silent --trace --verbose --version --paginate --no-pager --color --color= --width --width= --ignore-cache --ignore-user-rc
123-
comp_opts := -D -h -s -T -v -V -w $(comp_long_opts)
123+
comp_opts := -D -h -s -T -v -V -p -w $(comp_long_opts)
124124
comp_load_opts := --auto --no-auto --force -f --icase -i --tag --tag=
125125
comp_unload_opts := --auto --no-auto --force -f --icase -i
126126
comp_list_opts := -a -j -l -o -t --all --json --long --output --output= --terse

init/fish_completion

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ complete -c module -s S -l starts-with --description 'Search modules whose name
170170
complete -c module -s C -l contains --description 'Search modules whose name contains query string'
171171
complete -c module -l indepth --description 'Perform recursive avail search'
172172
complete -c module -l no-indepth --description 'Perform non-recursive avail search'
173-
complete -c module -l paginate --description 'Pipe mesg output into a pager if stream attached to terminal'
173+
complete -c module -s p -l paginate --description 'Pipe mesg output into a pager if stream attached to terminal'
174174
complete -c module -l no-pager --description 'Do not pipe message output into a pager'
175175
complete -c module -l auto --description 'Enable automated module handling mode'
176176
complete -c module -l no-auto --description 'Disable automated module handling mode'

init/zsh-functions/_module.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ _module() {
129129
'(-V --version)'{-V,--version}'[Module version]' \
130130
'--dumpname[Module implementation name]' \
131131
'(-w --width=)'{-w,--width=}'[Set output width]' \
132-
'--paginate[Pipe mesg output into a pager if stream attached to terminal]' \
132+
'(-p --paginate)'{-p,--paginate}'[Pipe mesg output into a pager if stream attached to terminal]' \
133133
'--no-pager[Do not pipe message output into a pager]' \
134134
'(--color --color=)'{--color,--color=}'[Colorize the output]' \
135135
'--ignore-cache[Ignore module cache]' \

tcl/main.tcl.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,7 @@ if {[catch {
702702
--dumpname {
703703
set show_name 1
704704
}
705-
--paginate {
705+
-p - --paginate {
706706
set asked_paginate 1
707707
}
708708
--no-pager {

tcl/report.tcl.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2169,7 +2169,7 @@ Options:
21692169
-v | --verbose Enable verbose messages
21702170
-s | --silent Turn off error, warning and informational messages
21712171
--timer Report execution times
2172-
--paginate Pipe mesg output into a pager if stream attached to terminal
2172+
-p | --paginate Pipe mesg output into a pager if stream attached to terminal
21732173
--no-pager Do not pipe message output into a pager
21742174
--redirect Send output to stdout (only for sh, bash, ksh, zsh and fish)
21752175
--no-redirect Send output to stderr

testsuite/modules.00-init/100-pager.exp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ if {$verbose} {
121121
}
122122
set env(LESS) $opts
123123
pager_test_case "" $pager_dfl_use "-" $install_pager $install_pageropts
124-
pager_test_case "--paginate" $pager_dfl_use "1" $install_pager $install_pageropts
124+
pager_test_case "-p" $pager_dfl_use "1" $install_pager $install_pageropts
125125
pager_test_case "--no-pager" 0 "0" $install_pager $install_pageropts
126126

127127
set opts ""
@@ -156,7 +156,7 @@ if {$verbose} {
156156
}
157157
set env(PAGER) $cmd
158158
pager_test_case "" $pager_dfl_use "-" $install_pager $install_pageropts
159-
pager_test_case "--paginate" $pager_dfl_use "1" $install_pager $install_pageropts
159+
pager_test_case "-p" $pager_dfl_use "1" $install_pager $install_pageropts
160160
pager_test_case "--no-pager" 0 "0" $install_pager $install_pageropts
161161

162162
set cmd "cat"
@@ -183,7 +183,7 @@ if {$verbose} {
183183
}
184184
set env(PAGER) $cmd
185185
pager_test_case "" $pager_dfl_use "-" $install_pager $install_pageropts
186-
pager_test_case "--paginate" $pager_dfl_use "1" $install_pager $install_pageropts
186+
pager_test_case "-p" $pager_dfl_use "1" $install_pager $install_pageropts
187187
pager_test_case "--no-pager" 0 "0" $install_pager $install_pageropts
188188

189189
set cmd "/usr/bin/less"
@@ -232,7 +232,7 @@ if {$verbose} {
232232
}
233233
set env(MODULES_PAGER) $cmd
234234
pager_test_case "" 0 "-" $cmd ""
235-
pager_test_case "--paginate" 0 "1" $cmd ""
235+
pager_test_case "-p" 0 "1" $cmd ""
236236
pager_test_case "--no-pager" 0 "0" $cmd ""
237237

238238
set cmd "cat"
@@ -259,7 +259,7 @@ if {$verbose} {
259259
}
260260
unset env(PAGER)
261261
pager_test_case "" 1 "-" $cmd $opts
262-
pager_test_case "--paginate" 1 "1" $cmd $opts
262+
pager_test_case "-p" 1 "1" $cmd $opts
263263
pager_test_case "--no-pager" 0 "0" $cmd $opts
264264

265265
if {$verbose} {
@@ -279,7 +279,7 @@ if {$verbose} {
279279
}
280280
set env(MODULES_PAGER) $cmd
281281
pager_test_case "" 1 "-" $cmd $opts
282-
pager_test_case "--paginate" 1 "1" $cmd $opts
282+
pager_test_case "-p" 1 "1" $cmd $opts
283283
pager_test_case "--no-pager" 0 "0" $cmd $opts
284284

285285

testsuite/modules.10-use/031-append.exp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,12 @@ testouterr_cmd "sh" "$use \$TESTSUITEDIR/modulefiles.2" $ans {}
9292
setenv_path_var MODULEPATH $modpath
9393

9494

95+
# test overriding options
96+
set ans [list]
97+
lappend ans [list set MODULEPATH $modpath:$path]
98+
testouterr_cmd sh "use -p -a $path" $ans {}
99+
100+
95101
#
96102
# Cleanup
97103
#

0 commit comments

Comments
 (0)