cmd: improve API for accessing multi-arg options
This commit is contained in:
@@ -169,6 +169,7 @@ typedef struct b_command_option b_command_option;
|
||||
typedef struct b_command_arg b_command_arg;
|
||||
typedef struct b_command_usage b_command_usage;
|
||||
typedef struct b_arglist b_arglist;
|
||||
typedef struct b_arglist_option b_arglist_option;
|
||||
|
||||
typedef int (*b_command_callback)(
|
||||
const b_command *, const b_arglist *, const b_array *);
|
||||
@@ -183,7 +184,8 @@ BLUE_API b_status b_command_set_long_name(b_command *cmd, const char *name);
|
||||
BLUE_API b_status b_command_set_short_name(b_command *cmd, char name);
|
||||
BLUE_API b_status b_command_set_flags(b_command *cmd, b_command_flags flags);
|
||||
BLUE_API b_status b_command_set_description(b_command *cmd, const char *description);
|
||||
BLUE_API b_status b_command_set_callback(b_command *cmd, b_command_callback callback);
|
||||
BLUE_API b_status b_command_set_callback(
|
||||
b_command *cmd, b_command_callback callback);
|
||||
BLUE_API b_status b_command_set_parent(b_command *cmd, unsigned int parent_id);
|
||||
BLUE_API b_command_option *b_command_add_option(b_command *cmd, int id);
|
||||
BLUE_API b_command_arg *b_command_add_arg(b_command *cmd, int id);
|
||||
@@ -206,7 +208,8 @@ BLUE_API b_status b_command_arg_set_allowed_values(
|
||||
|
||||
BLUE_API b_status b_command_usage_add_option(
|
||||
b_command_usage *usage, b_command_option *opt);
|
||||
BLUE_API b_status b_command_usage_add_arg(b_command_usage *usage, b_command_arg *opt);
|
||||
BLUE_API b_status b_command_usage_add_arg(
|
||||
b_command_usage *usage, b_command_arg *opt);
|
||||
BLUE_API b_status b_command_usage_add_command(
|
||||
b_command_usage *usage, unsigned int cmd_id);
|
||||
|
||||
@@ -219,9 +222,16 @@ BLUE_API b_status b_arglist_get_int(
|
||||
BLUE_API b_status b_arglist_get_uint(
|
||||
const b_arglist *args, unsigned int opt_id, unsigned int arg_id,
|
||||
unsigned int index, unsigned long long *out);
|
||||
BLUE_API b_status b_arglist_get_option(
|
||||
const b_arglist *args, unsigned int opt_id, unsigned int index,
|
||||
b_arglist_option **out);
|
||||
BLUE_API size_t b_arglist_get_count(
|
||||
const b_arglist *args, unsigned int opt_id, unsigned int arg_id);
|
||||
|
||||
BLUE_API b_status b_arglist_option_get_value(
|
||||
const b_arglist_option *opt, unsigned int arg_id, unsigned int index,
|
||||
b_arglist_value **out);
|
||||
|
||||
BLUE_API int b_arglist_iterator_begin(
|
||||
const b_arglist *args, unsigned int opt_filter, unsigned int arg_filter,
|
||||
b_arglist_iterator *it);
|
||||
|
||||
Reference in New Issue
Block a user