tag: add passthrough for positional arguments

This new tag tells the parser to stop processing flags after the
positional argument is encountered.

This is particularly useful for subcommands that forward their arguments
to an external program, and makes it possible to implement commands
like `kubectl exec` or `docker run`.

Fixes #80.
This commit is contained in:
Franklin "Snaipe" Mathieu
2021-04-04 19:30:00 +02:00
committed by Alec Thomas
parent 49417fe966
commit d4dd709445
6 changed files with 57 additions and 12 deletions
+1
View File
@@ -236,6 +236,7 @@ type Value struct {
Set bool // Set to true when this value is set through some mechanism.
Format string // Formatting directive, if applicable.
Position int // Position (for positional arguments).
Passthrough bool // Set to true to stop flag parsing when encountered.
}
// EnumMap returns a map of the enums in this value.