support -f example

This commit is contained in:
luyanbo 2021-10-11 01:28:57 +08:00
parent 981fa24569
commit 7a0f61e6a5

View file

@ -603,6 +603,11 @@ Loop:
args = args[1:] args = args[1:]
continue continue
} }
case strings.HasPrefix(s, "-") && !strings.Contains(s, "=") && len(s) == 2 && shortHasNoOptDefVal(s[1:], flags):
// If '-f' then
// delete '-f' from args or break the loop if len(args) <= 1.
beforeArgs = append(beforeArgs, s)
continue
case s != "" && !strings.HasPrefix(s, "-"): case s != "" && !strings.HasPrefix(s, "-"):
command = s command = s
afterArgs = args afterArgs = args