Hejsil / zig-clap

Command line argument parsing library
MIT License
939 stars 67 forks source link

Default values for arguments? #116

Closed jaywonchung closed 10 months ago

jaywonchung commented 10 months ago

If there a specific syntax to specify custom default values for arguments? For instance, I want -t, --temperature to be 0.9 if the user never specifies that option on the command line. Thanks a lot.

Hejsil commented 10 months ago

No, this is currently not supported. It's not really something I've thought too much about, since you can quite easily do a default when getting the value:

const temp = args.args.temperature orelse 0.9;
jaywonchung commented 10 months ago

Oh I see! That's good enough for me as well. Thanks.