Tools: Add option to display the library version

This commit is contained in:
Shahram Najm 2022-11-02 17:55:47 +00:00
parent 2ba6982e8a
commit 2f4935b496
1 changed files with 8 additions and 1 deletions

View File

@ -35,12 +35,13 @@ static int DBL_EQUAL(double d1, double d2, double tolerance)
static void usage(const char* prog)
{
printf("Usage: %s [-f] [-v] grib_file grib_file ...\n\n", prog);
printf("Usage: %s [-f] [-v] [-V] grib_file grib_file ...\n\n", prog);
printf("Check geometry of GRIB fields with a Gaussian Grid.\n");
printf("(The grid is assumed to be GLOBAL)\n\n");
printf("Options:\n");
printf(" -f Do not exit on first error\n");
printf(" -v Verbose\n");
printf(" -V Print the ecCodes version\n");
printf("\n");
exit(1);
}
@ -263,6 +264,12 @@ int main(int argc, char** argv)
}
exit_on_error = 0;
}
else if (STR_EQUAL(arg, "-V")) {
printf("\necCodes Version ");
grib_print_api_version(stdout);
printf("\n\n");
return 0;
}
else if (STR_EQUAL(arg, "-v")) {
if (argc < 3) {
usage(argv[0]);