浏览代码

r.in.gdal: use suppress_required

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@44426 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 14 年之前
父节点
当前提交
d8eaeed56a
共有 1 个文件被更改,包括 7 次插入16 次删除
  1. 7 16
      raster/r.in.gdal/main.c

+ 7 - 16
raster/r.in.gdal/main.c

@@ -80,20 +80,15 @@ int main(int argc, char *argv[])
     G_add_keyword(_("raster"));
     G_add_keyword(_("import"));
     module->description =
-	_("Import raster data into a GRASS map layer using GDAL.");
+	_("Imports raster data into a GRASS raster map using GDAL library.");
 
     /* -------------------------------------------------------------------- */
     /*      Setup and fetch parameters.                                     */
     /* -------------------------------------------------------------------- */
-    parm.input = G_define_standard_option(G_OPT_R_INPUT);
+    parm.input = G_define_standard_option(G_OPT_F_INPUT);
     parm.input->description = _("Raster file to be imported");
-    parm.input->gisprompt = "old_file,file,input";
-    parm.input->required = NO;	/* not required because of -f flag */
-    parm.input->guisection = _("Required");
-
+    
     parm.output = G_define_standard_option(G_OPT_R_OUTPUT);
-    parm.output->required = NO;	/* not required because of -f flag */
-    parm.output->guisection = _("Required");
 
     parm.band = G_define_option();
     parm.band->key = "band";
@@ -113,6 +108,7 @@ int main(int argc, char *argv[])
     parm.target->required = NO;
     parm.target->description =
 	_("Name of location to read projection from for GCPs transformation");
+    parm.target->key_desc = "name";
 
     parm.title = G_define_option();
     parm.title->key = "title";
@@ -127,6 +123,7 @@ int main(int argc, char *argv[])
     parm.outloc->type = TYPE_STRING;
     parm.outloc->required = NO;
     parm.outloc->description = _("Name for new location to create");
+    parm.outloc->key_desc = "name";
 
     flag_o = G_define_flag();
     flag_o->key = 'o';
@@ -141,7 +138,8 @@ int main(int argc, char *argv[])
     flag_f->key = 'f';
     flag_f->description = _("List supported formats and exit");
     flag_f->guisection = _("Print");
-
+    flag_f->suppress_required = 1;
+    
     flag_l = G_define_flag();
     flag_l->key = 'l';
     flag_l->description =
@@ -222,13 +220,6 @@ int main(int argc, char *argv[])
 	exit(EXIT_SUCCESS);
     }
 
-
-    if (!input)
-	G_fatal_error(_("Required parameter <%s> not set"), parm.input->key);
-
-    if (!output)
-	G_fatal_error(_("Name for output raster map not specified"));
-
     if (!parm.outloc->answer) {	/* Check if the map exists */
 	if (G_find_raster2(output, G_mapset())) {
 	    if (overwrite)