alecthomas / alecthomas/kingpin

Detect default true values for boolean flags and display the disable syntax

Aperta
#243 2 commenti 7 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Go
Stelle
3.6k
Fork
279
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

If I have a flag like
```go
app.Flag("store-token", "Store the acquired token in the system keyring").
Default("true").BoolVar(&authConfig.StoreToken)
```
Then currently it renders as
```
--store-token Store the acquired token in the system keyring
```
Even though the default value is always enabled.

It would be nice to have this situation detected, the default help show the parameter the user should actually set - i.e.
```
--no-store-token Store the acquired token in the system keyring
```

I guess I don't know how the description should be handled? Possibly an extra paramter on bool's for "negative description" so something like
```go
app.Flag("store-token", "Store the acquired token in the system keyring").
Default("true").BoolVar(&authConfig.StoreToken).NegationDescription("Do not store the acquired token in the system keyring")
```

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.