You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the UsageHelpConfig works under the assumption that library users will always want to either use both Usage and Help or neither, but not one or the other. It's also only limited to those two Arguments.
This new API would solve both of these issues:
Allow library users to choose exactly which Default Arguments they'd like to implement.
Create an API that's flexible to additional Default Arguments in the future w/o causing breaking changes. (For example, adding Version alongside Usage and Help).
DefaultArgsConfig Example:
/// Config for auto-generating Default Commands & Options during Initialization.pubconstDefaultArgsConfig=struct{
/// Add selected Default Commands to this Command and its sub-Commands.add_def_cmds: ?[]constDefaultArgKinds= &.{ .usage, .help, .version },
/// Add selected Default Options to this Command and its sub-Commands.add_def_opts: ?[]constDefaultArgKinds= &.{ .usage, .help, .version },
/// Set a name format for the Usage Options inner Value./// This only takes effect if `add_def_opts` is not null or empty./// Must support the following format types in this order:/// 1. String (Default Option Name)def_val_name: []constu8="{s}_flag",
/// Set a description format for the Usage Command & Option./// Must support the following format types in this order:/// 1. String (Command Name)/// 2. String (Default Command Name)def_desc_fmt: []constu8="Show the '{s}' {s} display.",
/// Add a Command Group for Default Commands./// Note, this will only take effect if `add_def_cmds` is not null or empty.add_def_cmd_group: AddDefaultGroup=.AddIfOthers,
/// Add an Option Group for Default Options./// Note, this will only take effect if `add_def_opts` is not null or empty.add_def_opt_group: AddHelpGroup=.AddIfOthers,
/// Default Argument Group Name.def_arg_group_name: []constu8="INFO",
/// Determine behavior for adding a Default Argument Group.pubconstAddDefaultGroup=enum{
/// Add if there are other Argument Groups.AddIfOthers,
/// Add regardless of other Argument Groups.Add,
/// Do not add.DoNotAdd,
};
/// Default Argument KindspubconstDefaultArgKinds=enum {
usage,
help,
version,
};
};
The text was updated successfully, but these errors were encountered:
Currently, the UsageHelpConfig works under the assumption that library users will always want to either use both Usage and Help or neither, but not one or the other. It's also only limited to those two Arguments.
This new API would solve both of these issues:
DefaultArgsConfig Example:
The text was updated successfully, but these errors were encountered: