cmd: add functions to report option/arg errors to the public API
This commit is contained in:
19
cmd/option.c
19
cmd/option.c
@@ -231,3 +231,22 @@ void z__b_get_option_usage_string(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct b_command_arg *b_command_option_get_arg_with_id(
|
||||
struct b_command_option *opt, unsigned int id)
|
||||
{
|
||||
b_queue_iterator it;
|
||||
b_queue_foreach (&it, &opt->opt_args) {
|
||||
struct b_command_arg *arg
|
||||
= b_unbox(struct b_command_arg, it.entry, arg_entry);
|
||||
if (!arg) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (arg->arg_id == id) {
|
||||
return arg;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user