#3585 closed enhancement (fixed)
Don't require -c for --tmp-location
| Reported by: | wenzeslaus | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | 8.0.0 |
| Component: | Startup | Version: | svn-trunk |
| Keywords: | init, grass.py, location, tmp-location, CRS, CLI, gsoc2018 | Cc: | |
| CPU: | Unspecified | Platform: | Unspecified |
Description
With this ticket, I'm seeking feedback for designing interface for creating temporary locations from command line.
With --tmp-location (#3537, r72790), CRS needs to be specified using the -c flag:
grass7 -c EPSG:3358 --tmp-location --exec g.proj -p
Without --tmp-location, -c is used to tell GRASS to create a new location or mapset. However, with --tmp-location GRASS knows that it needs to create a new location, so -c is required here to only specify the coordinate system. Thus, --tmp-location could itself require a value to be provided, so that the syntax would become:
grass7 --tmp-location EPSG:3358 --exec g.proj -p
Usage would look like (new):
grass75 --tmp-location [geofile | EPSG] --exec EXECUTABLE [EPARAM]...
Instead of (old):
grass75 -c [geofile | EPSG] --tmp-location --exec EXECUTABLE [EPARAM]...
Or concisely with a reference:
grass75 [-h | -help | --help | --h] [-v | --version]
[-c [CRS]] [-e] [-f]
[-text | -gtext | -gui] [--config param]
[[[GISDBASE/]LOCATION_NAME/]MAPSET]
grass75 [FLAG]... GISDBASE/LOCATION_NAME/MAPSET --exec EXECUTABLE [EPARAM]...
grass75 --tmp-location CPARAM --exec EXECUTABLE [EPARAM]...
...
CRS nothing or geofile or EPSG:code[:datum_trans]
CRS (or written like:) [geofile | EPSG:code[:datum_trans]]
EXECUTABLE GRASS module, script or any other executable
EPARAM parameters of the executable
FLAG standard flags
# Alternatives to CRS are SRS and CPARAM (like EPARAM).
Note 1: The current parsing does not care about order, so e.g. grass7 --tmp-location EPSG:3358 -c --exec... is possible now. This should be probably fixed in the future (e.g. 8.0.0 release). (It is not specified in the manual, so the current behavior can fixed/dropped any time.)
Note 2: This is part of making the command line as short as possible, so it might be strange that the --tmp-location flag is long, but that's a topic for another ticket.
Change History (5)
comment:1 by , 6 years ago
comment:2 by , 6 years ago
Many of them are legacy. -text is not really a good practice, -t and/or --text are better. See also: wiki:Grass8Planning#grassexecutable. The newer ones like --config are with two dashes which are also supported (but undocumented) for all other "long" flags.
comment:3 by , 6 years ago
Short feedback: I've started to use --tmp-location, it works nicely!
The only small confusion arises from
grass75 --tmp-location --exec g.extension v.clean.ogr ERROR: Flag --tmp-location requires also flag -c Exiting...
It would be good to get rid of -c for the --tmp-location case.

No objections from my side, only one question: what is the logic concerning - vs -- parameters ?