alecthomas / alecthomas/kingpin

HintAction can break the argument order

Aperta
#312 1 commento 1 reazione 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

go version go1.13.5 darwin/amd64
kingpn version v2.2.6

I came across a strange issue where the introduction of a HintAction broke the order of the arguments. I managed to come up with a small example, which you can find here:
https://github.com/OliverGoetz/kingpin-hintaction/blob/master/kingpin-hintaction.go

The gist of it is that under certain circumstances the HintAction implementation can break the order in which the arguments for a command are expected. This is also reflected in the help output as you can see here"

```
usage: kingpin-hintaction [] [ ...]

demo how hintaction breaks arg order

Flags:
-h, --help Show context-sensitive help (also try --help-long and --help-man).
--argset="x" set of arguments to use
--version Show application version.

Commands:
help [...]
Show help.

correctorder
Command with correct arg order

brokenorder
Command with broken arg order
```

For both commands the argument with number 1 should be first.

I don't understand this behaviour, but I cannot imagine that this is as intended.
It's also a mystery to me why the implementation of the HintAction should have any influence over this, as my understanding is that the HintAction methods are not even invoked when just a help message is printed out.

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.