diff options
author | Alex Wang <alexw@nicira.com> | 2014-09-11 17:24:35 -0700 |
---|---|---|
committer | Alex Wang <alexw@nicira.com> | 2014-10-28 18:33:10 -0700 |
commit | 66fa2c884fe9aee48217a76189a148bf215e0f5d (patch) | |
tree | 4ef6bce4bef9ea40be3ec4ef9572e229d2c78a02 /utilities | |
parent | ee4dac3bb6dcef43c51f7ddf3ad954eab4c9ed0f (diff) | |
download | openvswitch-66fa2c884fe9aee48217a76189a148bf215e0f5d.tar.gz |
command-line: Add function to print all options.
This commit adds a function that prints (both long and short)
options of a ovs-* command. To use this function, option
'--option' is added to ovs-appctl/dpctl/ofctl and ovsdb-tool
commands. A future patch will use the option output to
conduct bash command-line completion.
Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'utilities')
-rw-r--r-- | utilities/ovs-appctl.c | 6 | ||||
-rw-r--r-- | utilities/ovs-dpctl.c | 6 | ||||
-rw-r--r-- | utilities/ovs-ofctl.c | 5 |
3 files changed, 16 insertions, 1 deletions
diff --git a/utilities/ovs-appctl.c b/utilities/ovs-appctl.c index bb17ec27f..3d32cbd61 100644 --- a/utilities/ovs-appctl.c +++ b/utilities/ovs-appctl.c @@ -110,12 +110,14 @@ static const char * parse_command_line(int argc, char *argv[]) { enum { + OPT_START = UCHAR_MAX + 1, VLOG_OPTION_ENUMS }; static const struct option long_options[] = { {"target", required_argument, NULL, 't'}, {"execute", no_argument, NULL, 'e'}, {"help", no_argument, NULL, 'h'}, + {"option", no_argument, NULL, 'o'}, {"version", no_argument, NULL, 'V'}, {"timeout", required_argument, NULL, 'T'}, VLOG_LONG_OPTIONS, @@ -157,6 +159,10 @@ parse_command_line(int argc, char *argv[]) usage(); break; + case 'o': + print_options(long_options); + exit(EXIT_SUCCESS); + case 'T': time_alarm(atoi(optarg)); break; diff --git a/utilities/ovs-dpctl.c b/utilities/ovs-dpctl.c index 94a6b90f2..6d928af36 100644 --- a/utilities/ovs-dpctl.c +++ b/utilities/ovs-dpctl.c @@ -85,6 +85,7 @@ parse_options(int argc, char *argv[]) {"more", no_argument, NULL, 'm'}, {"timeout", required_argument, NULL, 't'}, {"help", no_argument, NULL, 'h'}, + {"option", no_argument, NULL, 'o'}, {"version", no_argument, NULL, 'V'}, VLOG_LONG_OPTIONS, {NULL, 0, NULL, 0}, @@ -130,6 +131,10 @@ parse_options(int argc, char *argv[]) case 'h': usage(NULL); + case 'o': + print_options(long_options); + exit(EXIT_SUCCESS); + case 'V': ovs_print_version(0, 0); exit(EXIT_SUCCESS); @@ -184,4 +189,3 @@ usage(void *userdata OVS_UNUSED) " -V, --version display version information\n"); exit(EXIT_SUCCESS); } - diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c index ae8d59d6d..77f5a298e 100644 --- a/utilities/ovs-ofctl.c +++ b/utilities/ovs-ofctl.c @@ -171,6 +171,7 @@ parse_options(int argc, char *argv[]) {"rsort", optional_argument, NULL, OPT_RSORT}, {"unixctl", required_argument, NULL, OPT_UNIXCTL}, {"help", no_argument, NULL, 'h'}, + {"option", no_argument, NULL, 'o'}, DAEMON_LONG_OPTIONS, OFP_VERSION_LONG_OPTIONS, VLOG_LONG_OPTIONS, @@ -240,6 +241,10 @@ parse_options(int argc, char *argv[]) case 'h': usage(); + case 'o': + print_options(long_options); + exit(EXIT_SUCCESS); + case OPT_STRICT: strict = true; break; |