gnulib-tool-py
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gnulib-tool-py] --verbose parameter and its value


From: Bruno Haible
Subject: Re: [gnulib-tool-py] --verbose parameter and its value
Date: Thu, 03 May 2012 23:11:50 +0200
User-agent: KMail/4.7.4 (Linux/3.1.10-1.9-desktop; KDE/4.7.4; x86_64; ; )

Hi Dmitriy,

> As you know there is --verbose parameter, which is supposed to be integer.

To be precise, there is a '--verbose' command line option and a 'verbose'
shell variable. The distinction is important here because, as you notice,
the correspondence is not 1:1 :

> As I understand this option can be repeated:
>       --verbose | --verbos | --verbo | --verb )
>         verbose=`expr $verbose + 1`
> 
> I've found a couple of commands where gnulib-tool tests if verbose argument
> is greater than: 1) 0; 2) 1; 3) -1.

This is because there is also a second option, --quiet, which also affects
the 'verbose' shell variable:

$ ./gnulib-tool --help | grep verbos
      --verbose             Increase verbosity. May be repeated.
      --quiet               Decrease verbosity. May be repeated.

and in the code:

      --verbose | --verbos | --verbo | --verb )
        verbose=`expr $verbose + 1`
        shift ;;
      --quiet | --quie | --qui | --qu | --q )
        verbose=`expr $verbose - 1`
        shift ;;

> Does that mean that the maximal value of verbosity is 1 and the minimal is
> -1? What does mean testing if verbosity is -1?

You can constrain the 'verbose' variable to be in the range [-2, 2]
(or maybe [-3, 3] for very rare use-cases).

> Does that means that 0 level
> of verbosity still prints to stdout messages, and you have to add parameter
> --quiet at least once to disable messages?

Exactly. verbose=0 is the default value, and it prints some info to stdout.
Users who don't like it pass the option --quiet.

Maybe it's useful to summarize in a table:

            \ Options | --quiet | default | --verbose | --verbose --verbose |
 Condition   \        |         |         |           |                     |
 ---------------------+---------+---------+-----------+---------------------+
 true                 |  true   |  true   |   true    |         true        |
 ---------------------+---------+---------+-----------+---------------------+
 test $verbose -ge -1 |  true   |  true   |   true    |         true        |
 ---------------------+---------+---------+-----------+---------------------+
 test $verbose -ge 0  |  false  |  true   |   true    |         true        |
 ---------------------+---------+---------+-----------+---------------------+
 test $verbose -ge 1  |  false  |  false  |   true    |         true        |
 ---------------------+---------+---------+-----------+---------------------+
 test $verbose -gt 1  |  false  |  false  |   false   |         true        |
 ---------------------+---------+---------+-----------+---------------------+
 false                |  false  |  false  |   false   |         false       |
 ---------------------+---------+---------+-----------+---------------------+

Bruno

PS: Btw, you can now drop Jim and Stefano from the CC. They are subscribed
    to the mailing list now.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]