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

feat(yay): add boolean flags #2285

Merged
merged 3 commits into from
Sep 27, 2023
Merged

feat(yay): add boolean flags #2285

merged 3 commits into from
Sep 27, 2023

Conversation

jdholtz
Copy link
Contributor

@jdholtz jdholtz commented Sep 18, 2023

This feature allows users to specify --option=bool instead of using --option and --nooption. Specifying nothing (or a bool value that isn't falsy) results in the boolean value being true.

A few notes on this PR:

  1. I didn't add documentation in the manpage yet because I wasn't sure how to present it to users. Suggestions would be helpful
  2. I marked the deprecated features with a DEPRECATED comment, but I can use a more robust deprecation system (such as a warning), if desired.
  3. These options do not work for pacman/makepkg options (except for debug and noconfirm). I can add this but it may make more sense for users to only use these boolean flags for yay options.
  4. The boolean flags only work with an equal sign unlike other flags that have values. I can switch it to allow --option <bool> too.

This feature now allows users to specify --<option>=<bool value> instead
of using --<option> and --no<option>. Specifying nothing results in the
boolean value being true. The flags prefixed with `no` are deprecated.
@jdholtz jdholtz requested a review from Jguer as a code owner September 18, 2023 14:24
@Jguer
Copy link
Owner

Jguer commented Sep 23, 2023

your reasoning makes a lot of sense.

  1. I think adding an example to the manpage/readme should be enough to show the 'yes, this works like this' for 1 or 2 of the affected options

  2. I think you can inject a log warn when parsing the deprecated options

  3. Agree

  4. I think we can leave it as is for now

Copy link
Owner

@Jguer Jguer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking the time to do this @jdholtz

@Jguer Jguer merged commit d368f99 into Jguer:next Sep 27, 2023
2 checks passed
@jdholtz jdholtz deleted the boolean-flags branch December 3, 2023 17:40
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

Successfully merging this pull request may close these issues.

2 participants