Skip to content

Support default values for short and long parameters #151

@tensorush

Description

@tensorush

It's a very minor nitpick, but I found myself trying to communicate to the user the default values of different parameters in their descriptions, and then reusing those same values when parsing:

const PARAMS = clap.parseParamsComptime(
    \\-o, --opt <u8>   Optional argument (default: 3)
    \\
);

pub fn main() !void {
    ...
    const opt_arg = cli.args.opt orelse 3;
    ...
}

It's not very error-prone as is, since default values don't usually change much, but it would be nicer to have a way of specifying default values and having them parsed automatically.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions