Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for yes/no booleans #54

Open
ikskuh opened this issue Mar 20, 2024 · 0 comments
Open

Add support for yes/no booleans #54

ikskuh opened this issue Mar 20, 2024 · 0 comments

Comments

@ikskuh
Copy link
Owner

ikskuh commented Mar 20, 2024

Some programs require "troolean" options that can have a default, but also be forced to true and false.

We can either implement it as a special case for ?bool or provide a custom type for this:

const Trinary = enum { unset, false, true };

var cli = parse(struct {
    @"emit-bin": ?bool = null, // --emit-bin and --no-emit-bin
    @"emit-bin": args.Trinary = .unset, // --emit-bin and --no-emit-bin
}, …);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant