Fix flag removal regex
This commit is contained in:
parent
0bffa3e2a4
commit
a7428315e3
4
main.go
4
main.go
@ -64,11 +64,11 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create regex to remove all flags using ";;;" as it is uncommon to use in command line
|
// Create regex to remove all flags using ";;;" as it is uncommon to use in command line
|
||||||
flagRegex := regexp.MustCompile(`-+[^;]*;;;`)
|
flagRegex := regexp.MustCompile(`(?m)(;;;|^)-+[^;]*;;;`)
|
||||||
// Join args into string
|
// Join args into string
|
||||||
argsStr := strings.Join(args, ";;;")
|
argsStr := strings.Join(args, ";;;")
|
||||||
// Remove all flags from join args
|
// Remove all flags from join args
|
||||||
argsStr = flagRegex.ReplaceAllString(argsStr, "")
|
argsStr = flagRegex.ReplaceAllString(argsStr, "$1")
|
||||||
// Separate args back into slice
|
// Separate args back into slice
|
||||||
args = strings.Split(argsStr, ";;;")
|
args = strings.Split(argsStr, ";;;")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user