@@ -28,7 +28,7 @@ func main() {
2828
2929 formattedNames := make ([]string , 0 )
3030 for _ , name := range names {
31- formattedNames = append (formattedNames , fmt .Sprintf ("\t \" %v\" ," , name ))
31+ formattedNames = append (formattedNames , fmt .Sprintf (" \" %v\" ," , name ))
3232 }
3333
3434 maxlen := 0
@@ -40,7 +40,7 @@ func main() {
4040
4141 formattedDescriptions := make ([]string , 0 )
4242 for _ , name := range names {
43- formattedDescriptions = append (formattedDescriptions , fmt .Sprintf (` %--` + strconv .Itoa (maxlen + 4 )+ `v"%v",` , fmt .Sprintf (`"%v": ` , name ), descriptions [name ]))
43+ formattedDescriptions = append (formattedDescriptions , fmt .Sprintf (` %--` + strconv .Itoa (maxlen + 4 )+ `v"%v",` , fmt .Sprintf (`"%v": ` , name ), descriptions [name ]))
4444 }
4545
4646 cases := make ([]string , 0 )
@@ -73,8 +73,8 @@ func executeCompleter(completer string) {
7373
7474 os .Mkdir (root + "/cmd/carapace/cmd/completers" , 0755 )
7575 os .WriteFile (root + "/cmd/carapace/cmd/completers.go" , []byte ("//go:build !release\n \n " + content ), 0644 )
76- os .WriteFile (root + "/cmd/carapace/cmd/completers/name.go" , []byte (fmt .Sprintf ("package completers\n \n var names = []string{\n %v\n }\n " , strings .Join (formattedNames , "\n " ))), 0644 )
77- os .WriteFile (root + "/cmd/carapace/cmd/completers/description.go" , []byte (fmt .Sprintf ("package completers\n \n var descriptions = map[string]string{\n %v\n }\n " , strings .Join (formattedDescriptions , "\n " ))), 0644 )
76+ os .WriteFile (root + "/cmd/carapace/cmd/completers/name.go" , []byte (fmt .Sprintf ("package completers\n \n func init() { \n names = []string{\n %v\n \t } \n }\n " , strings .Join (formattedNames , "\n " ))), 0644 )
77+ os .WriteFile (root + "/cmd/carapace/cmd/completers/description.go" , []byte (fmt .Sprintf ("package completers\n \n func init() { \n descriptions = map[string]string{\n %v\n \t } \n }\n " , strings .Join (formattedDescriptions , "\n " ))), 0644 )
7878 os .WriteFile (root + "/cmd/carapace/cmd/completers_release.go" , []byte ("//go:build release\n \n " + strings .Replace (content , "/completers/" , "/completers_release/" , - 1 )), 0644 )
7979 os .RemoveAll (root + "/completers_release" )
8080 execabs .Command ("cp" , "-r" , root + "/completers" , root + "/completers_release" ).Run ()
0 commit comments