Fix sub-commands using passthrough args not splitting on '--'
This commit is contained in:
parent
0bec3a6e05
commit
e6da6a3453
@ -11,6 +11,7 @@ import (
|
||||
"isle/jsonutil"
|
||||
"isle/toolkit"
|
||||
"os"
|
||||
"slices"
|
||||
"strings"
|
||||
|
||||
"dev.mediocregopher.com/mediocre-go-lib.git/mlog"
|
||||
@ -221,7 +222,14 @@ func (ctx subCmdCtx) withParsedFlags(
|
||||
os.Exit(2)
|
||||
}
|
||||
|
||||
if err := ctx.flags.Parse(ctx.opts.args); err != nil {
|
||||
parseArgs := ctx.opts.args
|
||||
if opts.passthroughArgs {
|
||||
if i := slices.Index(parseArgs, "--"); i >= 0 {
|
||||
parseArgs, ctx.opts.args = parseArgs[:i], parseArgs[i+1:]
|
||||
}
|
||||
}
|
||||
|
||||
if err := ctx.flags.Parse(parseArgs); err != nil {
|
||||
return ctx, err
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user