Skip to content
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

[Feat] g.region: implement standalone flat flag in g.region #3409

Open
echoix opened this issue Feb 8, 2024 · 1 comment
Open

[Feat] g.region: implement standalone flat flag in g.region #3409

echoix opened this issue Feb 8, 2024 · 1 comment
Assignees
Labels
C Related code is in C general module
Milestone

Comments

@echoix
Copy link
Member

echoix commented Feb 8, 2024

Flag -f of g.region should be standalone. Now it needs to be used together with -g flag. Standalone behavior aligns with the current description of the flag:

Print in shell script style, but in one line (flat)

In terms of backwards compatibility, there shouldn't be any problem, because -gf should still work.

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)

Originally posted by @petrasovaa in #3216 (review)

@petrasovaa petrasovaa changed the title [Feat] Implement standalone flag flag in g.region [Feat] g.region: implement standalone flat flag in g.region Feb 8, 2024
@petrasovaa petrasovaa self-assigned this Feb 8, 2024
@petrasovaa petrasovaa added C Related code is in C module general labels Feb 8, 2024
@petrasovaa petrasovaa added this to the 8.4.0 milestone Feb 8, 2024
@HuidaeCho
Copy link
Member

-gf should still work.

Ideally, we should make them exclusive in v9.

@neteler neteler modified the milestones: 8.4.0, 8.4.1 Jul 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C Related code is in C general module
Projects
None yet
Development

No branches or pull requests

4 participants