tomb

the crypto undertaker
git clone git://parazyd.org/tomb.git
Log | Files | Refs | README | LICENSE

commit 040b3fe3bb9b0862c28e0a9fc7a70e5c46844c7b
parent fb5d1d2cf9b7989327d004bd924bc2845be309df
Author: boyska <piuttosto@logorroici.org>
Date:   Mon, 31 Oct 2011 23:34:21 +0100

FIX #59 : --no-color do as expected
includes documentation for --no-color

Diffstat:
Mdoc/tomb.1 | 4++++
Msrc/tomb | 10++++++----
2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/doc/tomb.1 b/doc/tomb.1 @@ -135,8 +135,12 @@ Display version and quit .B .IP "-q" Run more quietly +.B .IP "-D" 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 diff --git a/src/tomb b/src/tomb @@ -37,8 +37,6 @@ typeset -A opts # PATH=/usr/bin:/usr/sbin:/bin:/sbin -autoload colors; colors - # standard output message routines # 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 } @@ -1247,8 +1245,8 @@ main() { # There are two reasons for that: # I. usability; user expect that "-s" is "size # 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) - main_opts=(q -quiet=q D -debug=D h -help=h v -version=v) + # (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 -no-color) subcommands_opts[__default]="" subcommands_opts[open]="n -nohook=n k: -key=k o: -mount-options=o -ignore-swap" subcommands_opts[mount]=${subcommands_opts[open]} @@ -1321,6 +1319,10 @@ main() { fi ### 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) for opt in ${(k)global_opts}; do if [[ $opt == '-q' ]]; then