Merge pull request #78 from gechr/gc-fix-fish-completion

Fix fish shell completion
This commit is contained in:
Eyal Posener 2019-02-08 12:17:02 +02:00 committed by GitHub
commit 43c37e8a9f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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} params := struct{ Cmd, Bin string }{cmd, bin}
tmpl := template.Must(template.New("cmd").Parse(` tmpl := template.Must(template.New("cmd").Parse(`
function __complete_{{.Cmd}} function __complete_{{.Cmd}}
set -lx COMP_LINE (string join ' ' (commandline -o)) set -lx COMP_LINE (commandline -cp)
test (commandline -ct) = "" test -z (commandline -ct)
and set COMP_LINE "$COMP_LINE " and set COMP_LINE "$COMP_LINE "
{{.Bin}} {{.Bin}}
end end
complete -c {{.Cmd}} -a "(__complete_{{.Cmd}})" complete -f -c {{.Cmd}} -a "(__complete_{{.Cmd}})"
`)) `))
err := tmpl.Execute(&buf, params) err := tmpl.Execute(&buf, params)
if err != nil { if err != nil {