Hi developers,
I added new module - g.message - to cvs, which should be used in shell
(and other scripts). It's purpose is to replace echo commands for
printing (progress) messages. Flags for fatal error and warning (and
debug) are available too.
Sample usage:
GRASS> g.message "Reprojecting maps"
"Reprojecting maps"
GRASS> g.message -w "Coordinate system not set, using default"
WARNING: Coordinate system not set, using default
GRASS> g.message -f "Input map not found"
ERROR: Input map not found
Advantages:
- Scripts will be able to print messages according to GRASS_VERBOSE variable
- Keywords will be translated
- Long messages will be formated according to GRASS settings
- All messages will be printed to STDERR automaticly
Questions:
Do you think, it is a good idea?
Shall I update SUBMITTING_SCRIPTS accordingly?
Jachym
--
Jachym Cepicky
e-mail: jachym.cepicky gmail com
URL: http://les-ejk.cz
GPG: http://www.les-ejk.cz/pgp/jachym_cepicky-gpg.pub
Jachym Cepicky wrote on 03/23/2007 10:56 AM:
Hi developers,
I added new module - g.message - to cvs, which should be used in shell
(and other scripts). It's purpose is to replace echo commands for
printing (progress) messages. Flags for fatal error and warning (and
debug) are available too.
Sample usage:
GRASS> g.message "Reprojecting maps"
"Reprojecting maps"
GRASS> g.message -w "Coordinate system not set, using default"
WARNING: Coordinate system not set, using default
GRASS> g.message -f "Input map not found"
ERROR: Input map not found
I have changed -f to -e to be more intuitive for script programmers
(as personally discussed with Jachym).
Advantages:
- Scripts will be able to print messages according to GRASS_VERBOSE
variable
- Keywords will be translated
- Long messages will be formated according to GRASS settings
- All messages will be printed to STDERR automaticly
Questions:
Do you think, it is a good idea?
Yes!
Shall I update SUBMITTING_SCRIPTS accordingly?
Also yes. If possible, it would be good to update as many scripts
as possible with some perl/python/whatever converter since new
scripts are often derived from existing ones.
Markus
------------------
ITC -> dall'1 marzo 2007 Fondazione Bruno Kessler
ITC -> since 1 March 2007 Fondazione Bruno Kessler
------------------