Fix fish shell completion

This commit is contained in:
George Christou 2019-02-07 21:07:13 +00:00
parent 3ef9b31a6a
commit 1fa456f134
No known key found for this signature in database
GPG Key ID: B62A5D71FE6CAC90
1 changed files with 3 additions and 3 deletions

View File

@ -41,12 +41,12 @@ func (f fish) cmd(cmd, bin string) (string, error) {
params := struct{ Cmd, Bin string }{cmd, bin}
tmpl := template.Must(template.New("cmd").Parse(`
function __complete_{{.Cmd}}
set -lx COMP_LINE (string join ' ' (commandline -o))
test (commandline -ct) = ""
set -lx COMP_LINE (commandline -cp)
test -z (commandline -ct)
and set COMP_LINE "$COMP_LINE "
{{.Bin}}
end
complete -c {{.Cmd}} -a "(__complete_{{.Cmd}})"
complete -f -c {{.Cmd}} -a "(__complete_{{.Cmd}})"
`))
err := tmpl.Execute(&buf, params)
if err != nil {