Tools: Add -h option

This commit is contained in:
Shahram Najm 2023-11-02 19:52:42 +00:00
parent e2470a8c60
commit 082b721c4f
21 changed files with 46 additions and 22 deletions

View File

@ -34,7 +34,8 @@ grib_option grib_options[] = {
{ "I", 0, 0, 1, 0, 0 },
{ "V", 0, 0, 0, 1, 0 },
{ "7", 0, 0, 0, 1, 0 },
{ "v", 0, 0, 0, 1, 0 }
{ "v", 0, 0, 0, 1, 0 },
{ "h", 0, 0, 0, 1, 0 },
};
int grib_options_count = sizeof(grib_options) / sizeof(grib_option);

View File

@ -44,7 +44,8 @@ grib_option grib_options[] = {
{ "g", 0, 0, 0, 1, 0 },
{ "7", 0, 0, 0, 1, 0 },
{ "X:", 0, 0, 0, 1, 0 },
{ "v", 0, 0, 0, 1, 0 }
{ "v", 0, 0, 0, 1, 0 },
{ "h", 0, 0, 0, 1, 0 },
};
int grib_options_count = sizeof(grib_options) / sizeof(grib_option);

View File

@ -53,7 +53,8 @@ grib_option grib_options[] = {
{ "V", 0, 0, 0, 1, 0 },
{ "q", 0, 0, 1, 0, 0 },
{ "S:", "subset_number", "\n\t\tDump the given subset\n", 0, 1, 0 },
{ "X:", 0, 0, 0, 1, 0 }
{ "X:", 0, 0, 0, 1, 0 },
{ "h", 0, 0, 0, 1, 0 },
/* {"x",0,0,0,1,0} */
};

View File

@ -23,7 +23,8 @@ grib_option grib_options[] = {
/* {"G",0,0,0,1,0}, */
{ "T:", 0, 0, 1, 0, "B" },
{ "7", 0, 0, 0, 1, 0 },
{ "v", 0, 0, 0, 1, 0 }
{ "v", 0, 0, 0, 1, 0 },
{ "h", 0, 0, 0, 1, 0 },
};
const char* tool_description =
"Apply the rules defined in rules_file to each BUFR "

View File

@ -27,7 +27,8 @@ grib_option grib_options[] = {
/* {"G",0,0,0,1,0}, */
{ "T:", 0, 0, 1, 0, "B" },
{ "7", 0, 0, 0, 1, 0 },
{ "v", 0, 0, 1, 0, 0 }
{ "v", 0, 0, 1, 0, 0 },
{ "h", 0, 0, 0, 1, 0 },
};
const char* tool_description =

View File

@ -34,7 +34,8 @@ grib_option grib_options[] = {
{ "N", 0,
"Do not compress index."
"\n\t\tBy default the index is compressed to remove keys with only one value.\n",
0, 1, 0 }
0, 1, 0 },
{ "h", 0, 0, 0, 1, 0 },
};
static int compress_index;

View File

@ -30,7 +30,8 @@ grib_option grib_options[] = {
{ "P", 0, 0, 1, 0, 0 },
{ "T:", 0, 0, 1, 0, "B" },
{ "7", 0, 0, 0, 1, 0 },
{ "v", 0, 0, 1, 0, 0 }
{ "v", 0, 0, 1, 0, 0 },
{ "h", 0, 0, 0, 1, 0 },
};
const char* tool_description =

View File

@ -35,7 +35,8 @@ grib_option grib_options[] = {
/* {"G",0,0,0,1,0}, */
{ "T:", 0, 0, 1, 0, "B" },
{ "f", 0, 0, 0, 1, 0 },
{ "v", 0, 0, 0, 1, 0 }
{ "v", 0, 0, 0, 1, 0 },
{ "h", 0, 0, 0, 1, 0 },
};
const char* tool_description =

View File

@ -34,7 +34,8 @@ grib_option grib_options[] = {
{ "I", 0, 0, 1, 0, 0 },
{ "V", 0, 0, 0, 1, 0 },
{ "7", 0, 0, 0, 1, 0 },
{ "v", 0, 0, 0, 1, 0 }
{ "v", 0, 0, 0, 1, 0 },
{ "h", 0, 0, 0, 1, 0 },
};
int grib_options_count = sizeof(grib_options) / sizeof(grib_option);

View File

@ -48,7 +48,8 @@ grib_option grib_options[] = {
{ "G", 0, 0, 0, 1, 0 },
{ "7", 0, 0, 0, 1, 0 },
{ "X:", 0, 0, 0, 1, 0 },
{ "v", 0, 0, 0, 1, 0 }
{ "v", 0, 0, 0, 1, 0 },
{ "h", 0, 0, 0, 1, 0 },
};
int grib_options_count = sizeof(grib_options) / sizeof(grib_option);

View File

@ -31,7 +31,8 @@ grib_option grib_options[] = {
{ "p:", "key1,key2,...",
"\n\t\tDeclaration of keys to dump. Only those keys are dumped (not the whole message).\n", 0, 1, 0 },
{ "X:", 0, 0, 0, 1, 0 },
{ "x", 0, 0, 0, 1, 0 }
{ "x", 0, 0, 0, 1, 0 },
{ "h", 0, 0, 0, 1, 0 },
};
const char* tool_description = "Dump the content of a GRIB file in different formats.";

View File

@ -24,7 +24,8 @@ grib_option grib_options[] = {
{ "G", 0, 0, 0, 1, 0 },
{ "T:", 0, 0, 0, 1, 0 },
{ "7", 0, 0, 0, 1, 0 },
{ "v", 0, 0, 0, 1, 0 }
{ "v", 0, 0, 0, 1, 0 },
{ "h", 0, 0, 0, 1, 0 },
};
const char* tool_description =
"Apply the rules defined in rules_file to each GRIB "

View File

@ -32,7 +32,8 @@ grib_option grib_options[] = {
{ "7", 0, 0, 0, 1, 0 },
{ "v", 0, 0, 1, 0, 0 },
{ "X:", 0, 0, 0, 1, 0 },
{ "i:", 0, 0, 0, 1, 0 }
{ "i:", 0, 0, 0, 1, 0 },
{ "h", 0, 0, 0, 1, 0 },
};
const char* tool_description =

View File

@ -31,7 +31,8 @@ grib_option grib_options[] = {
{ "G", 0, 0, 0, 1, 0 },
{ "7", 0, 0, 0, 1, 0 },
{ "X:", 0, 0, 0, 1, 0 },
{ "V", 0, 0, 0, 1, 0 }
{ "V", 0, 0, 0, 1, 0 },
{ "h", 0, 0, 0, 1, 0 },
};
const char* tool_description =

View File

@ -15,7 +15,8 @@ grib_option grib_options[] = {
{ "V", 0, 0, 0, 1, 0 },
{ "p:", 0, 0, 0, 1, 0 }, /* print keys */
{ "S", 0, 0, 1, 0, 0 }, /* needed for skip */
{ "w:", 0, 0, 0, 1, 0 } /* 'where' clause */
{ "w:", 0, 0, 0, 1, 0 }, /* 'where' clause */
{ "h", 0, 0, 0, 1, 0 },
};
int grib_options_count = sizeof(grib_options) / sizeof(grib_option);

View File

@ -33,7 +33,8 @@ grib_option grib_options[] = {
{ "N", 0,
"Do not compress index."
"\n\t\tBy default the index is compressed to remove keys with only one value.\n",
0, 1, 0 }
0, 1, 0 },
{ "h", 0, 0, 0, 1, 0 },
};
static int compress_index;

View File

@ -35,7 +35,8 @@ grib_option grib_options[] = {
{ "7", 0, 0, 0, 1, 0 },
{ "v", 0, 0, 1, 0, 0 },
{ "X:", 0, 0, 0, 1, 0 },
{ "x", 0, 0, 0, 1, 0 }
{ "x", 0, 0, 0, 1, 0 },
{ "h", 0, 0, 0, 1, 0 },
};
const char* tool_description =

View File

@ -56,7 +56,8 @@ grib_option grib_options[] = {
{ "g", 0, 0, 0, 1, 0 },
{ "G", 0, 0, 0, 1, 0 },
{ "7", 0, 0, 0, 1, 0 },
{ "v", 0, 0, 0, 1, 0 }
{ "v", 0, 0, 0, 1, 0 },
{ "h", 0, 0, 0, 1, 0 },
};
int grib_options_count = sizeof(grib_options) / sizeof(grib_option);

View File

@ -106,8 +106,8 @@ static grib_options_help grib_options_help_list[] = {
{ "k:", "key1,key2,...",
"\n\t\tSpecify a list of keys to index on. By default the input files are indexed on the MARS keys."
"\n\t\tFor each key a string (key:s) or a double (key:d) or an integer (key:i)"
"\n\t\ttype can be requested.\n" }
"\n\t\ttype can be requested.\n" },
{ "h", 0, "Display this help text and exit.\n" }
};
static int grib_options_help_count = sizeof(grib_options_help_list) / sizeof(grib_options_help);
@ -198,6 +198,10 @@ int grib_process_runtime_options(grib_context* context, int argc, char** argv, g
int has_input_extra = 0, nfiles = 0;
char *karg = NULL, *warg = NULL, *sarg = NULL, *barg = NULL;
if (grib_options_on("h")) {
usage();
}
if (grib_options_on("V")) {
printf("\necCodes Version ");
grib_print_api_version(stdout);

View File

@ -39,7 +39,8 @@ grib_option grib_options[] = {
{ "G", 0, 0, 0, 1, 0 },
{ "T:", 0, 0, 0, 1, 0 },
{ "f", 0, 0, 0, 1, 0 },
{ "v", 0, 0, 0, 1, 0 }
{ "v", 0, 0, 0, 1, 0 },
{ "h", 0, 0, 0, 1, 0 },
};
const char* tool_description =

View File

@ -3936,7 +3936,8 @@ grib_option grib_options[] = {
"\n\t\tChunking strategy based on GRIB message.\n",
0, 1, "6" },
{ "s", 0, "Shuffle data before deflation compression.\n", 0, 1, 0 },
{ "u:", "dimension", "\n\t\tSet dimension to be an unlimited dimension.\n", 0, 1, "time" }
{ "u:", "dimension", "\n\t\tSet dimension to be an unlimited dimension.\n", 0, 1, "time" },
{ "h", 0, 0, 0, 1, 0 },
};
int grib_options_count = sizeof(grib_options) / sizeof(grib_option);