alecthomas / alecthomas/kingpin

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

Aberta
#243 2 comentários 7 reações 0 responsáveis Ver no GitHub
Linguagem predominante
Go
Estrelas
3.6k
Forks
279
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

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")
```

Guia de contribuição

Nenhum guia de contribuição indexado para este repositório

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.