mirror of https://github.com/ecmwf/eccodes.git
ECC-1073: grib_ls/bufr_ls with the JSON option: Set key 'file'
This commit is contained in:
parent
aea5aa5fa3
commit
b11cdf670f
|
@ -105,6 +105,10 @@ int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h)
|
|||
exit(err);
|
||||
}
|
||||
if (options->json_output) {
|
||||
if (options->current_infile->name) {
|
||||
size_t len = strlen(options->current_infile->name);
|
||||
grib_set_string(h, "file", options->current_infile->name, &len);
|
||||
}
|
||||
if (!first_handle && options->handle_count > 1) {
|
||||
fprintf(stdout, ",\n");
|
||||
}
|
||||
|
|
|
@ -360,6 +360,10 @@ int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h)
|
|||
}
|
||||
|
||||
if (!json_latlon && options->json_output) {
|
||||
if (options->current_infile->name) {
|
||||
size_t len = strlen(options->current_infile->name);
|
||||
grib_set_string(h, "file", options->current_infile->name, &len);
|
||||
}
|
||||
if (!first_handle && options->handle_count > 1) {
|
||||
fprintf(stdout, ",\n");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue