Dynamically Hide Flags with Variables
- Lingua principale
- Go
- Stelle
- 3.2k
- Fork
- 188
- Merge medio
- 1g 1h
- PR unite (30g)
- 2
Descrizione
Hey! This is a fantastic project that I am using to build a new command-line application and it is working really well so far, and I am very much enjoying using it.
I have a bit of a complex use case that I wanted to ask if was reasonable to introduce some logic for.
Essentially, I have LOTS of flags that I am reusing and composing for different commands and sometimes I want to hide them since they can get noisy and potentially only show the sub-flags that are relevant instead of all of the flags in the `struct`.
I was wondering if it is reasonable to allow the `hidden:""` value of a flag property to take a boolean so that it is possible to dynamically hide flags as it is possible to dynamically set their default values.
My thinking is that then you could use variables to `hide:"${flagHidden}"` and set the variables in the parent struct so that it's possible to dynamically hide flags. To avoid breaking changes I am guessing we would do the following logic:
1. If `hidden:""` tag is present hide the flag / cmd, etc...
2. If `hidden:"true"` is set to true hide the flag / cmd, etc...
3. If `hidden:"false"` is set to false don't hide the flag.
What do you think about this? I'd suggest we implement this only if it is not too complicated as I can work around this by creating different structs with different tags and using them but it would be super nice if this logic worked as described above 😄
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Valutazione
Questa issue non è ancora stata valutata.