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]>
---
 lib/table.c               | 16 ++++++++++++++++
 lib/table.h               |  1 +
 ovn/utilities/ovn-nbctl.c |  1 +
 ovn/utilities/ovn-sbctl.c |  1 +
 ovsdb/ovsdb-client.c      |  9 ++-------
 utilities/ovs-vsctl.c     |  1 +
 vtep/vtep-ctl.c           |  1 +
 7 files changed, 23 insertions(+), 7 deletions(-)

diff --git a/lib/table.c b/lib/table.c
index 9158499..6136beb 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 7330a33..fee3689 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 ebb9349..598f502 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 4e3cbad..ffa931a 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 ba232fc..1df4fb4 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 4d9845e..84176de 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 e23c987..7dc3cc7 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");
-- 
2.7.4

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to