Dynamically Hide Flags with Variables
- Lenguaje dominante
- Go
- Estrellas
- 3.2k
- Forks
- 188
- Merge medio
- 1 d 1 h
- PR fusionados (30 d)
- 2
Descripción
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 😄
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Evaluación
Este issue todavía no se ha evaluado.