mirror of
https://github.com/Llewellynvdm/Tomb.git
synced 2025-01-24 07:28:25 +00:00
FIX #59 : --no-color do as expected
includes documentation for --no-color
This commit is contained in:
parent
fb5d1d2cf9
commit
040b3fe3bb
@ -135,8 +135,12 @@ Display version and quit
|
|||||||
.B
|
.B
|
||||||
.IP "-q"
|
.IP "-q"
|
||||||
Run more quietly
|
Run more quietly
|
||||||
|
.B
|
||||||
.IP "-D"
|
.IP "-D"
|
||||||
Print more information while running, for debugging purposes
|
Print more information while running, for debugging purposes
|
||||||
|
.B
|
||||||
|
.IP "--no-color"
|
||||||
|
Don't use colors; useful for old terminals or integration in other scripts
|
||||||
|
|
||||||
|
|
||||||
.SH HOOKS
|
.SH HOOKS
|
||||||
|
10
src/tomb
10
src/tomb
@ -37,8 +37,6 @@ typeset -A opts
|
|||||||
|
|
||||||
# PATH=/usr/bin:/usr/sbin:/bin:/sbin
|
# PATH=/usr/bin:/usr/sbin:/bin:/sbin
|
||||||
|
|
||||||
autoload colors; colors
|
|
||||||
|
|
||||||
# standard output message routines
|
# standard output message routines
|
||||||
# it's always useful to wrap them, in case we change behaviour later
|
# it's always useful to wrap them, in case we change behaviour later
|
||||||
notice() { if [[ $QUIET == 0 ]]; then print "$fg_bold[green][*]$fg_no_bold[white] $1" >&2; fi }
|
notice() { if [[ $QUIET == 0 ]]; then print "$fg_bold[green][*]$fg_no_bold[white] $1" >&2; fi }
|
||||||
@ -1247,8 +1245,8 @@ main() {
|
|||||||
# There are two reasons for that:
|
# There are two reasons for that:
|
||||||
# I. usability; user expect that "-s" is "size
|
# I. usability; user expect that "-s" is "size
|
||||||
# II. Option parsing WILL EXPLODE if you do this kind of bad things
|
# II. Option parsing WILL EXPLODE if you do this kind of bad things
|
||||||
# (it will say "option defined more than once, and he's right)
|
# (it will say "option defined more than once, and he's right")
|
||||||
main_opts=(q -quiet=q D -debug=D h -help=h v -version=v)
|
main_opts=(q -quiet=q D -debug=D h -help=h v -version=v -no-color)
|
||||||
subcommands_opts[__default]=""
|
subcommands_opts[__default]=""
|
||||||
subcommands_opts[open]="n -nohook=n k: -key=k o: -mount-options=o -ignore-swap"
|
subcommands_opts[open]="n -nohook=n k: -key=k o: -mount-options=o -ignore-swap"
|
||||||
subcommands_opts[mount]=${subcommands_opts[open]}
|
subcommands_opts[mount]=${subcommands_opts[open]}
|
||||||
@ -1321,6 +1319,10 @@ main() {
|
|||||||
fi
|
fi
|
||||||
### End parsing command-specific options
|
### End parsing command-specific options
|
||||||
|
|
||||||
|
if ! option_is_set --no-color; then
|
||||||
|
autoload colors; colors
|
||||||
|
fi
|
||||||
|
|
||||||
### Set global options (useless, but for code retro-compatibility)
|
### Set global options (useless, but for code retro-compatibility)
|
||||||
for opt in ${(k)global_opts}; do
|
for opt in ${(k)global_opts}; do
|
||||||
if [[ $opt == '-q' ]]; then
|
if [[ $opt == '-q' ]]; then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user