Fix flag removal regex

This commit is contained in:
Elara 2020-11-30 15:40:40 -08:00
parent 0bffa3e2a4
commit a7428315e3
1 changed files with 2 additions and 2 deletions

View File

@ -64,11 +64,11 @@ func main() {
}
// 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
argsStr := strings.Join(args, ";;;")
// Remove all flags from join args
argsStr = flagRegex.ReplaceAllString(argsStr, "")
argsStr = flagRegex.ReplaceAllString(argsStr, "$1")
// Separate args back into slice
args = strings.Split(argsStr, ";;;")