-
Notifications
You must be signed in to change notification settings - Fork 70
Open
Labels
Description
Thanks for making this lib it's quite useful. Please see the error and potential problem outlined below.
10:21:07 chrome@Beast src → bit complete
install completion for bit? y
installing...
regexp: Compile(`^complete -C C:\Users\chrome\go\bin\bit.exe bit$`): error parsing regexp: invalid escape sequence: `\U`
goroutine 1 [running]:
runtime/debug.Stack(0xf51840, 0xc000006018, 0xc00011cc78)
C:/Dev/Go/src/runtime/debug/stack.go:24 +0xa5
github.com/chriswalz/bit/cmd.HandleExit()
C:/Users/chrome/go/pkg/mod/github.com/chriswalz/bit@v1.0.1/cmd/util.go:320 +0xea
panic(0xe0cfe0, 0xc0000533f0)
C:/Dev/Go/src/runtime/panic.go:965 +0x1c7
regexp.MustCompile(0xc000376510, 0x30, 0x1)
C:/Dev/Go/src/regexp/regexp.go:311 +0x15f
github.com/chriswalz/complete/v3/install.lineInFile(0xc00001cd38, 0x17, 0xc0003764b0, 0x2e, 0x2)
C:/Users/chrome/go/pkg/mod/github.com/chriswalz/complete/v3@v3.0.12/install/utils.go:12 +0x12c
github.com/chriswalz/complete/v3/install.bash.IsInstalled(0xc00001cd38, 0x17, 0xea613a, 0x3, 0xc000376450, 0x1e, 0x2)
C:/Users/chrome/go/pkg/mod/github.com/chriswalz/complete/v3@v3.0.12/install/bash.go:15 +0xfc
github.com/chriswalz/complete/v3/install.bash.Install(0xc00001cd38, 0x17, 0xea613a, 0x3, 0xc000376450, 0x1e, 0x0, 0x0)
C:/Users/chrome/go/pkg/mod/github.com/chriswalz/complete/v3@v3.0.12/install/bash.go:19 +0x77
github.com/chriswalz/complete/v3/install.Install(0xea613a, 0x3, 0xc00011d350, 0xe)
C:/Users/chrome/go/pkg/mod/github.com/chriswalz/complete/v3@v3.0.12/install/install.go:66 +0xf6
According to this comment the problem is due to:
-
https://github.com/posener/complete/blob/master/install/bash.go#L36
-
https://github.com/posener/complete/blob/master/install/bash.go#L15
-
https://github.com/posener/complete/blob/master/install/utils.go#L12
The code seems to assume that cmd or bin doesn't contain any regexp characters. The 3. probably should escape all those characters. It's weird that it's using regexps for that in the first place.