Skip to content

Commit

Permalink
table: provide table formatting option help at runtime
Browse files Browse the repository at this point in the history
Show table formatting options with help output from
ovn-nbctl, obn-sbctl, ovs-vsctl, and vtep-ctl commands.
Include "--data" option in ovsdb-client help output.

Signed-off-by: Lance Richardson <[email protected]>
Signed-off-by: Ben Pfaff <[email protected]>
  • Loading branch information
hlrichardson authored and blp committed Apr 6, 2017
1 parent d897038 commit bcb58ce
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 7 deletions.
16 changes: 16 additions & 0 deletions lib/table.c
Original file line number Diff line number Diff line change
Expand Up @@ -594,3 +594,19 @@ table_print(const struct table *table, const struct table_style *style)
break;
}
}

void
table_usage(void)
{
printf("\nOutput formatting options:\n"
" -f, --format=FORMAT set output formatting to FORMAT\n"
" (\"table\", \"html\", \"csv\", "
"or \"json\")\n"
" -d, --data=FORMAT set table cell output formatting to\n"
" FORMAT (\"string\", \"bare\", "
"or \"json\")\n"
" --no-headings omit table heading row\n"
" --pretty pretty-print JSON in output\n"
" --bare equivalent to "
"\"--format=list --data=bare --no-headings\"\n");
}
1 change: 1 addition & 0 deletions lib/table.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,5 +121,6 @@ void table_parse_format(struct table_style *, const char *format);
void table_parse_cell_format(struct table_style *, const char *format);

void table_print(const struct table *, const struct table_style *);
void table_usage(void);

#endif /* table.h */
1 change: 1 addition & 0 deletions ovn/utilities/ovn-nbctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,7 @@ Options:\n\
--oneline print exactly one line of output per command\n",
program_name, program_name, ctl_get_db_cmd_usage(),
default_nb_db());
table_usage();
vlog_usage();
printf("\
--no-syslog equivalent to --verbose=nbctl:syslog:warn\n");
Expand Down
1 change: 1 addition & 0 deletions ovn/utilities/ovn-sbctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ Options:\n\
--oneline print exactly one line of output per command\n",
program_name, program_name, ctl_get_db_cmd_usage(),
default_sb_db());
table_usage();
vlog_usage();
printf("\
--no-syslog equivalent to --verbose=sbctl:syslog:warn\n");
Expand Down
9 changes: 2 additions & 7 deletions ovsdb/ovsdb-client.c
Original file line number Diff line number Diff line change
Expand Up @@ -282,13 +282,8 @@ usage(void)
"The default DATABASE is Open_vSwitch.\n",
program_name, program_name, ovs_rundir());
stream_usage("SERVER", true, true, true);
printf("\nOutput formatting options:\n"
" -f, --format=FORMAT set output formatting to FORMAT\n"
" (\"table\", \"html\", \"csv\", "
"or \"json\")\n"
" --no-headings omit table heading row\n"
" --pretty pretty-print JSON in output\n"
" --timestamp timestamp \"monitor\" output");
table_usage();
printf(" --timestamp timestamp \"monitor\" output");
daemon_usage();
vlog_usage();
printf("\nOther options:\n"
Expand Down
1 change: 1 addition & 0 deletions utilities/ovs-vsctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,7 @@ Options:\n\
--dry-run do not commit changes to database\n\
--oneline print exactly one line of output per command\n",
program_name, program_name, ctl_get_db_cmd_usage(), ctl_default_db());
table_usage();
vlog_usage();
printf("\
--no-syslog equivalent to --verbose=vsctl:syslog:warn\n");
Expand Down
1 change: 1 addition & 0 deletions vtep/vtep-ctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ Options:\n\
--dry-run do not commit changes to database\n\
--oneline print exactly one line of output per command\n",
program_name, program_name, ctl_get_db_cmd_usage(), ctl_default_db());
table_usage();
vlog_usage();
printf("\
--no-syslog equivalent to --verbose=vtep_ctl:syslog:warn\n");
Expand Down

0 comments on commit bcb58ce

Please sign in to comment.