docs
This commit is contained in:
parent
49dbeed687
commit
10682fbde6
@ -252,8 +252,11 @@ func reorderArgs(commandFlags []Flag, args []string) []string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func argIsFlag(commandFlags []Flag, arg string) bool {
|
func argIsFlag(commandFlags []Flag, arg string) bool {
|
||||||
|
// this line turns `--flag` into `flag`
|
||||||
arg = strings.ReplaceAll(arg, "-", "")
|
arg = strings.ReplaceAll(arg, "-", "")
|
||||||
|
// this line turns `flag=value` into `flag`
|
||||||
arg = strings.Split(arg, "=")[0]
|
arg = strings.Split(arg, "=")[0]
|
||||||
|
// look through all the flags, to see if the `arg` is one of our flags
|
||||||
for _, flag := range commandFlags {
|
for _, flag := range commandFlags {
|
||||||
for _, key := range strings.Split(flag.GetName(), ",") {
|
for _, key := range strings.Split(flag.GetName(), ",") {
|
||||||
if key == arg {
|
if key == arg {
|
||||||
|
Loading…
Reference in New Issue
Block a user