cmd: improve command usage strings

the command usage strings now use the actual argument values provided by the user, in particular for the names of relevant commands
This commit is contained in:
2025-08-09 19:36:46 +01:00
parent fae8ffe4f8
commit bcbd85372e
4 changed files with 52 additions and 25 deletions

View File

@@ -98,6 +98,9 @@ struct b_arglist_option {
};
struct b_arglist {
size_t list_argc;
const char **list_argv;
unsigned int list_argv_last_command;
struct b_command *list_command;
struct b_btree list_options;
};
@@ -134,7 +137,8 @@ BLUE_API b_status b_arglist_parse(
BLUE_API void b_arglist_destroy(struct b_arglist *args);
BLUE_API struct b_string *z__b_command_default_usage_string(
struct b_command *cmd, struct b_command_option *with_opt);
struct b_command *cmd, struct b_command_option *with_opt,
const struct b_arglist *args);
BLUE_API void z__b_get_arg_usage_string(
struct b_command_arg *arg, bool colour, struct b_string *out);