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
@@ -450,6 +450,7 @@ Tag | Description
`prefix:"X"` | Prefix for all sub-flags.
`set:"K=V"` | Set a variable for expansion by child elements. Multiples can occur.
`embed` | If present, this field's children will be embedded in the parent. Useful for composition.
`passthrough` | If present, this positional argument stops flag parsing when encountered, as if `--` was processed before. Useful for external command wrappers, like `exec`.
`-` | Ignore the field. Useful for adding non-CLI fields to a configuration struct.
## Plugins