alecthomas / alecthomas/kong

Command is validated before flags

Aberta
#611 0 comentários 0 reações 0 responsáveis Ver no GitHub
Linguagem predominante
Go
Estrelas
3.2k
Forks
188
Merge médio
1d 1h
PRs com merge (30d)
2

Descrição

Command is validated before its flags. I expect command validation to operate on already-validated flags. Here is a simple demonstration: https://go.dev/play/p/fk5EOSl7MuN

```go
type CLI struct {
Command Command `cmd:""`
}

type Command struct {
Flag Flag
}

func (Command) Validate() error {
fmt.Println("validate command")
return nil
}

type Flag string

func (Flag) Validate() error {
fmt.Println("validate flag")
return nil
}

func main() {
kong.Must(&CLI{}).Parse([]string{"command", "--flag", "value"})
// validate command
// validate flag
}

```

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.