[GRASS-dev] Force --v flag whenever -l is instructed

Nikos Alexandris nik at nikosalexandris.net
Mon Oct 9 03:49:33 PDT 2017


* Nikos Alexandris <nik at nikosalexandris.net> [2017-10-09 12:18:29 +0200]:

>* Moritz Lennert <moritz.lennert at ulb.ac.be> [2017-10-09 10:59:25 +0200]:
>
>>On 07/10/17 10:39, Nikos Alexandris wrote:
>>>In a grassy script, how can I force verbosity, i.e. --v whenever a flag
>>>-l is instructed? Which will lead to
>>>
>>>env['GRASS_VERBOSE'] = '3'
>>>
>>>?
>>>
>>>
>>>i.some.module input=some_input -l
>>>
>>>should be identical to
>>>
>>>i.some.module input=some_input -l --v
>>>
>>>
>>>The following is, of course, not working:
>>>
>>>#%rules
>>>#% requires_all: -l,--v
>>>#%end
>>>
>>
>>I don't think the -- flags are covered by the rules, so I think you 
>>have to do this in the code, i.e. something like this:
>>
>>if flags['l']:
>>	env['GRASS_VERBOSE'] = '3'
>
>Merci Moritz,
>
>I tested already (before asking)
>
>env = os.environ.copy()
>if list_only:
>   env['GRASS_VERBOSE'] = '3'
>
>but it does not work.
>
>Aren't there other ways?
>
>Thank you again, N

I guess simply

GRASS_VERBOSE=3
export GRASS_VERBOSE

It works!

See https://grasswiki.osgeo.org/wiki/Scripting

N


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20171009/8c236509/attachment.sig>


More information about the grass-dev mailing list