Hejsil / Hejsil/zig-clap

Support default values for short and long parameters

Open
#151 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Zig
Stars
1.6k
Forks
99
Avg merge
3h 53m
Merged PRs (30d)
1

Description

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:

```zig
const PARAMS = clap.parseParamsComptime(
\\-o, --opt 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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.