summaryrefslogtreecommitdiff
path: root/tools/command.h
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2017-03-07 11:47:44 -0600
committerDavid Teigland <teigland@redhat.com>2017-03-08 11:03:02 -0600
commit690f60473352e9909df95fae96a5d99b8b0c9db7 (patch)
tree2f62dcad94b66eccc419675703284b25185e3765 /tools/command.h
parentf48e6b2690c43120ec87e4fa913b2bd952a53511 (diff)
downloadlvm2-690f60473352e9909df95fae96a5d99b8b0c9db7.tar.gz
commands: combine duplicate arrays for opt and val
command.c and lvmcmdline.c each had a full array defining all options and values. This duplication was not removed when the command.c code was merged into the run time.
Diffstat (limited to 'tools/command.h')
-rw-r--r--tools/command.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/tools/command.h b/tools/command.h
index 2e4dba337..7652d7409 100644
--- a/tools/command.h
+++ b/tools/command.h
@@ -211,6 +211,30 @@ struct command {
int pos_count; /* temp counter used by create-command */
};
+/* see global opt_names[] */
+
+struct opt_name {
+ const char *name; /* "foo_ARG" */
+ int opt_enum; /* foo_ARG */
+ const char short_opt; /* -f */
+ char _padding[7];
+ const char *long_opt; /* --foo */
+ int val_enum; /* xyz_VAL when --foo takes a val like "--foo xyz" */
+ uint32_t flags;
+ uint32_t prio;
+ const char *desc;
+};
+
+/* see global val_names[] */
+
+struct val_name {
+ const char *enum_name; /* "foo_VAL" */
+ int val_enum; /* foo_VAL */
+ int (*fn) (struct cmd_context *cmd, struct arg_values *av); /* foo_arg() */
+ const char *name; /* FooVal */
+ const char *usage;
+};
+
int define_commands(char *run_name);
int command_id_to_enum(const char *str);
void print_usage(struct command *cmd, int longhelp, int desc_first);