Cmd can be passthrough now, too.

Fixes #253.
This commit is contained in:
Mitar
2022-01-04 21:58:56 +01:00
committed by Alec Thomas
parent 76d5ed9ac1
commit a7d3850e80
6 changed files with 129 additions and 23 deletions
+14
View File
@@ -361,6 +361,10 @@ func (c *Context) trace(node *Node) (err error) { // nolint: gocyclo
flags = append(flags, group...)
}
if node.Passthrough {
c.endParsing()
}
for !c.scan.Peek().IsEOL() {
token := c.scan.Peek()
switch token.Type {
@@ -901,6 +905,16 @@ func checkEnum(value *Value, target reflect.Value) error {
}
}
func checkPassthroughArg(target reflect.Value) bool {
typ := target.Type()
switch typ.Kind() {
case reflect.Slice:
return typ.Elem().Kind() == reflect.String
default:
return false
}
}
func checkXorDuplicates(paths []*Path) error {
for _, path := range paths {
seen := map[string]*Flag{}