Skip to content

Commit

Permalink
update handling for shell script output
Browse files Browse the repository at this point in the history
  • Loading branch information
kritibirda26 committed Jun 18, 2024
1 parent 4f5e8fe commit 071d259
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions vector/v.info/parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,25 @@ void parse_args(int argc, char **argv, char **input, char **field, int *history,
*shell |= SHELL_TOPO;

if (strcmp(format_opt->answer, "plain") == 0) {
*format_ptr = PLAIN;
// if shell flags are specified and format=PLAIN (default),
// print in shell script format
if (*shell != 0) {
*format_ptr = SHELL;
}
else {
*format_ptr = PLAIN;
}
}
else if (strcmp(format_opt->answer, "json") == 0)
*format_ptr = JSON;
else {
*format_ptr = SHELL;
}

if (*shell != 0 && *format_ptr == PLAIN) {
*format_ptr = SHELL;
// if shell flags are specified with format=shell, obey them
// if only format=shell is specified, print all info
if (*shell == 0) {
*shell |= SHELL_BASIC;
*shell |= SHELL_REGION;
*shell |= SHELL_TOPO;
}
}
}

0 comments on commit 071d259

Please sign in to comment.