00JCIV00 / cova

Commands, Options, Values, Arguments. A simple yet robust cross-platform command line argument parsing library for Zig.
https://00jciv00.github.io/cova/
MIT License
110 stars 5 forks source link

Global command option to set the default format strings to "". #51

Closed p7r0x7 closed 10 months ago

p7r0x7 commented 10 months ago

I use custom callbacks for everything, so I don't need these strings to exist in my binaries. This chaos could be mitigated with a global command option to set the default format strings to "".

/// Cova configuration type identity
const CommandT = cova.Command.Custom(.{
    .cmd_alias_fmt = "",
    .help_header_fmt = "",
    .subcmd_alias_fmt = "",
    .subcmds_help_fmt = "",
    .subcmds_usage_fmt = "",
    .subcmds_help_title_fmt = "",
    .vals_help_title_fmt = "",
    .opts_help_title_fmt = "",
    .usage_header_fmt = "",
    .group_title_fmt = "",
    .group_sep_fmt = "",

    .indent_fmt = "    ",
    .global_help_prefix = "",
    .global_case_sensitive = false,
    .global_vals_mandatory = false,
    .global_sub_cmds_mandatory = false,
    .global_usage_fn = printers.commandUsage,
    .global_help_fn = printers.commandHelp,
    .opt_config = .{
        .help_fmt = "",
        .usage_fmt = "",
        .global_usage_fn = printers.optionUsage,
        .global_help_fn = printers.optionHelp,
        .allow_abbreviated_long_opts = false,
        .allow_opt_val_no_space = true,
        .opt_val_seps = "=:",
        .short_prefix = null,
        .long_prefix = "-",
    },
    .val_config = .{
        .help_fmt = "",
        .usage_fmt = "",
        .global_usage_fn = printers.valueUsage,
        .global_help_fn = printers.valueHelp,
        .global_set_behavior = .Last,
        .add_base_floats = false,
        .add_base_ints = false,
        .use_slim_base = true,
        .max_children = 1,
    },
});
00JCIV00 commented 10 months ago

I have this all loaded up in a commit. It just isn't pushed yet.

00JCIV00 commented 10 months ago

Added in commit b2520ab95407c671b9ccdb763d5c3e5862e4b0a6