summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLance Richardson <lrichard@redhat.com>2017-03-31 13:21:03 -0400
committerBen Pfaff <blp@ovn.org>2017-04-06 08:04:55 -0700
commitbcb58ce069b91970c68e4c38385fa3b43dbc07dc (patch)
treee2e9b8af160b60bd77dff839a68a1f2800d128eb
parentd897038a4a1cd35bd23e07a3939c5950cec1ec0f (diff)
downloadopenvswitch-bcb58ce069b91970c68e4c38385fa3b43dbc07dc.tar.gz
table: provide table formatting option help at runtime
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 <lrichard@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
-rw-r--r--lib/table.c16
-rw-r--r--lib/table.h1
-rw-r--r--ovn/utilities/ovn-nbctl.c1
-rw-r--r--ovn/utilities/ovn-sbctl.c1
-rw-r--r--ovsdb/ovsdb-client.c9
-rw-r--r--utilities/ovs-vsctl.c1
-rw-r--r--vtep/vtep-ctl.c1
7 files changed, 23 insertions, 7 deletions
diff --git a/lib/table.c b/lib/table.c
index 9158499bf..6136beb2f 100644
--- a/lib/table.c
+++ b/lib/table.c
@@ -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");
+}
diff --git a/lib/table.h b/lib/table.h
index 7330a33c1..fee36897f 100644
--- a/lib/table.h
+++ b/lib/table.h
@@ -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 */
diff --git a/ovn/utilities/ovn-nbctl.c b/ovn/utilities/ovn-nbctl.c
index ebb9349dc..598f502af 100644
--- a/ovn/utilities/ovn-nbctl.c
+++ b/ovn/utilities/ovn-nbctl.c
@@ -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");
diff --git a/ovn/utilities/ovn-sbctl.c b/ovn/utilities/ovn-sbctl.c
index 4e3cbadac..ffa931ae1 100644
--- a/ovn/utilities/ovn-sbctl.c
+++ b/ovn/utilities/ovn-sbctl.c
@@ -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");
diff --git a/ovsdb/ovsdb-client.c b/ovsdb/ovsdb-client.c
index ba232fce1..1df4fb4da 100644
--- a/ovsdb/ovsdb-client.c
+++ b/ovsdb/ovsdb-client.c
@@ -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"
diff --git a/utilities/ovs-vsctl.c b/utilities/ovs-vsctl.c
index 4d9845e6a..84176dea9 100644
--- a/utilities/ovs-vsctl.c
+++ b/utilities/ovs-vsctl.c
@@ -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");
diff --git a/vtep/vtep-ctl.c b/vtep/vtep-ctl.c
index e23c987da..7dc3cc775 100644
--- a/vtep/vtep-ctl.c
+++ b/vtep/vtep-ctl.c
@@ -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");