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: Dmitriy Selyutin
Subject: Re: [gnulib-tool-py] --verbose parameter and its value
Date: Fri, 4 May 2012 01:43:16 +0400

Thank you very much, Bruno!

>> You can constrain the 'verbose' variable to be in the range [-2, 2]
>> (or maybe [-3, 3] for very rare use-cases).
OK, I've done it just now. To change this more easy I've defined new dictionary MODES in constants.py. So to get the maximal value for verbose level, type something like

from pygnulib import constants
min_verbose = constant.MODES['verbose-min']
max_verbose = constant.MODES['verbose-max']

I hope this will be useful in the future. And of course MODES dictionary will be larger in the future. :-)

>> Btw, you can now drop Jim and Stefano from the CC. They are subscribed
>> to the mailing list now.
OK, I've dropped them. Shall I drop you too or it will be better to leave you in the CC?


2012/5/4 Bruno Haible <address@hidden>
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]