Skip to content

Add support for negatable flags (--[no-]color)#718

Merged
DannyBen merged 1 commit into
masterfrom
add/negatable-flags
Jul 9, 2026
Merged

Add support for negatable flags (--[no-]color)#718
DannyBen merged 1 commit into
masterfrom
add/negatable-flags

Conversation

@DannyBen

@DannyBen DannyBen commented Jul 9, 2026

Copy link
Copy Markdown
Member

The main motivation behind this feature, is the recently added argfile support, which means that users can define something like --color in their argfile, and then they have no way to disable it.

This can now be mitigated easily with:

flags:
- long: --color
  short: -c
  help: Enable color output
  negatable: true

  • Implementation
  • Specs
  • Bashly bash completions
  • Bashly CLI docs (bashly doc flag.negatable)
  • JSON schema
  • bashly.dev docs - Source | Preview

@DannyBen DannyBen added this to the 1.4.0 milestone Jul 9, 2026
@DannyBen
DannyBen merged commit 3343ac8 into master Jul 9, 2026
8 checks passed
@DannyBen
DannyBen deleted the add/negatable-flags branch July 9, 2026 13:35
@meleu

meleu commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

You'll receive a notification because of this message and I really hope you don't take it as a waste of your time.

Instead, I want you to receive my appreciation of your work on this feature! That's going to decrease the amount of code we need to handle just to add the --no- version of some options.

Thanks dude! ❤️

@DannyBen

Copy link
Copy Markdown
Member Author

@meleu, are you kidding buddy? I thought we were friends... :)

a) I am always happy to hear that someone else finds things I do useful, even more so from long time users and contributors.
b) If you wanted this feature, you could have asked

Personally, I didn't see a point to this feature before we added the argfile support - now users can state --color in the argfile, and then there is no way to turn it off, so --[no-]color now has a stronger reasoning for existing.

I am curious what is your use case for needing it.

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