From 2c298d987780f7e0c6db2e2a8ab72d4629be43a4 Mon Sep 17 00:00:00 2001 From: Huidae Cho Date: Fri, 22 Mar 2024 22:30:53 -0600 Subject: [PATCH] v.db.connect: Replace -o flag with the standard --overwrite (#3214) * v.db.connect: Implement standard --overwrite and remove -o flag * Add -o => --overwrite to renamed_options --- lib/gis/renamed_options | 2 ++ vector/v.db.connect/main.c | 13 ++++--------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/lib/gis/renamed_options b/lib/gis/renamed_options index f9bf12fd832..e996126a9b0 100644 --- a/lib/gis/renamed_options +++ b/lib/gis/renamed_options @@ -468,6 +468,8 @@ v.buffer|bufcolumn:column v.clean|thresh:threshold # v.colors v.colors|volume:raster_3d +# v.db.connect +v.db.connect|-o:--overwrite # v.db.join v.db.join|otable:other_table v.db.join|ocolumn:other_column diff --git a/vector/v.db.connect/main.c b/vector/v.db.connect/main.c index 09e3ef9d84f..3ba874d1223 100644 --- a/vector/v.db.connect/main.c +++ b/vector/v.db.connect/main.c @@ -34,7 +34,7 @@ int main(int argc, char **argv) struct GModule *module; struct Option *inopt, *dbdriver, *dbdatabase, *dbtable, *field_opt, *dbkey, *sep_opt; - struct Flag *overwrite, *print, *columns, *delete, *shell_print; + struct Flag *print, *columns, *delete, *shell_print; dbDriver *driver; dbString table_name; dbTable *table; @@ -101,11 +101,6 @@ int main(int argc, char **argv) "layer and exit"); columns->guisection = _("Print"); - overwrite = G_define_flag(); - overwrite->key = 'o'; - overwrite->description = - _("Overwrite connection parameter for certain layer"); - delete = G_define_flag(); delete->key = 'd'; delete->description = @@ -271,9 +266,9 @@ int main(int argc, char **argv) G_debug(3, "Vect_map_check_dblink = %d", ret); if (ret == 1) { /* field already defined */ - if (!overwrite->answer) - G_fatal_error(_("Use -o to overwrite existing link " - "for layer <%d>"), + if (!G_get_overwrite()) + G_fatal_error(_("Use --overwrite to overwrite " + "existing link for layer <%d>"), field); else { dbColumn *column;