-
-
Notifications
You must be signed in to change notification settings - Fork 321
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
g.region: Fix the flat flag #3216
Conversation
Maybe later for a new release in a separate PR, it would be better to imply Or it just needs a better description because other flags are also accumulative as well? |
There are print flags that add information ( I agree the There are some flags that don't seem to be behaving consistently, e.g. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 for making flat really one line. This strangeness was there for a while and it prevents use in shell scripting without addition of a grep filter.
A test for -gf
and -f
would be nice, e.g., testing that -f
really yields one line only which was apparently missing. There is already general/g.region/testsuite/
so it should be relatively easy to add a new test.
I think that falls into the general revision of all output formats below.
I also expect that.
That would be ideal. |
Done. |
Agreed, but I think that's for another PR. |
Yep, GMT doesn't have a key. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested it and added a test for the f flag.
I tested the standalone -f flag, here is the code for it, but probably you are right this should be a separate PR.
diff --git a/general/g.region/main.c b/general/g.region/main.c
index 06c33a2e8c..33ad06f383 100644
--- a/general/g.region/main.c
+++ b/general/g.region/main.c
@@ -361,7 +361,7 @@ int main(int argc, char *argv[])
G_option_required(
flag.dflt, flag.savedefault, flag.print, flag.lprint, flag.eprint,
flag.center, flag.gmt_style, flag.wms_style, flag.dist_res, flag.nangle,
- flag.z, flag.bbox, flag.gprint, flag.res_set, flag.noupdate,
+ flag.z, flag.bbox, flag.gprint, flag.flprint, flag.res_set, flag.noupdate,
parm.region, parm.raster, parm.raster3d, parm.vect, parm.north,
parm.south, parm.east, parm.west, parm.top, parm.bottom, parm.rows,
parm.cols, parm.res, parm.res3, parm.nsres, parm.ewres, parm.tbres,
@@ -371,7 +371,6 @@ int main(int argc, char *argv[])
flag.eprint, flag.center, flag.gmt_style, flag.wms_style,
flag.dist_res, flag.nangle, flag.z, flag.bbox,
flag.gprint, parm.save, NULL);
- G_option_requires(flag.flprint, flag.gprint, NULL);
if (G_parser(argc, argv))
exit(EXIT_FAILURE);
@@ -383,7 +382,7 @@ int main(int argc, char *argv[])
if (flag.print->answer)
print_flag |= PRINT_REG;
- if (flag.gprint->answer)
+ if (flag.gprint->answer || flat_flag)
print_flag |= PRINT_SH;
if (flag.lprint->answer)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I read the changes and they make sense for what it says it does ;)
Created issues to not forget about the other points, so this PR should be good to merge, it was already reviewed and approved, and I took another look at it. |
* g.region: Fix the flat flag * Revert datum: and ellipsoid: * Flatten other outputs * Flat (-f) requires shell (-g) print * Flatten WMS output * add test * fix formatting --------- Co-authored-by: Anna Petrasova <[email protected]> Co-authored-by: Edouard Choinière <[email protected]>
This PR prints
projection=
andzone=
in the same one line for the flat-f
flag.Before:
After: