You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Recently, we were introducing JSON outputs and in the past, we already introduced the format parameter to tools like v.db.select. One question which remains is how the key-value format usually enabled by -g should be called? Documentation usually calls it something along the lines of "shell script style". The format is usually =-separated key-value pairs, one per line and unique keys (not always though). The original idea was that it can be put directly to Bash's eval function. This is the format typically parsed in the past by grass.script.parse_command to create a Python dictionary with keys and values provided by -g (side note: now that parses JSON as well but still defaults to expecting =-separated key-values).
Question
How the following flag should be replaced with a format option/parameter? Specifically, which value to use for the format option?
-g Print the stats in shell script style
Examples
This flag is, for example, found in r.univar and format option allows switching only between plain and json. -g right now acts as a modifier of the plain format. However, the idea is to present that as its own format which is likely more precise and fits with other tools with multiple formats. See these formats in v.db.select:
plain: Configurable plain text output
csv: CSV (Comma Separated Values)
json: JSON (JavaScript Object Notation)
vertical: Plain text vertical output (instead of horizontal)
r.univar has only:
plain: Plain text output
json: JSON (JavaScript Object Notation)
Feel free to add your suggestions or combinations of the above.
The description will be easy to change in the future, but the value is part of the API, so we need to set it and stick to it. Thus, the big decision is really between sh, shell, bash, script, eval, key-value, keyvalue, keyval, eqsep, ...
Implementation in v8 versus v9
In v8, we would add this to existing tools which now have format option and -g flag, for example r.univar. -g would stay there for compatibility. In v9, we can remove -g and only format would be used to change the output format. (This is similar to what happened with -v Vertical output (instead of horizontal) in v.db.select between v7 and v8.)
The text was updated successfully, but these errors were encountered:
I'm putting this a blocker for the next major/minor release because it would be good to get it right for the release. (A backward compatible change in the future is possible, but it is avoidable if we decide soon.)
Background
Recently, we were introducing JSON outputs and in the past, we already introduced the
format
parameter to tools like v.db.select. One question which remains is how the key-value format usually enabled by-g
should be called? Documentation usually calls it something along the lines of "shell script style". The format is usually=
-separated key-value pairs, one per line and unique keys (not always though). The original idea was that it can be put directly to Bash's eval function. This is the format typically parsed in the past by grass.script.parse_command to create a Python dictionary with keys and values provided by-g
(side note: now that parses JSON as well but still defaults to expecting=
-separated key-values).Question
How the following flag should be replaced with a format option/parameter? Specifically, which value to use for the format option?
Examples
This flag is, for example, found in r.univar and format option allows switching only between plain and json. -g right now acts as a modifier of the plain format. However, the idea is to present that as its own format which is likely more precise and fits with other tools with multiple formats. See these formats in v.db.select:
r.univar has only:
but should have something like:
Suggestions
Options:
Feel free to add your suggestions or combinations of the above.
The description will be easy to change in the future, but the value is part of the API, so we need to set it and stick to it. Thus, the big decision is really between sh, shell, bash, script, eval, key-value, keyvalue, keyval, eqsep, ...
Implementation in v8 versus v9
In v8, we would add this to existing tools which now have
format
option and-g
flag, for example r.univar.-g
would stay there for compatibility. In v9, we can remove-g
and onlyformat
would be used to change the output format. (This is similar to what happened with-v Vertical output (instead of horizontal)
in v.db.select between v7 and v8.)The text was updated successfully, but these errors were encountered: