From 8e785ef4104d54ad5d38180e00e5e0bd6f2ee698 Mon Sep 17 00:00:00 2001 From: rsteube Date: Sun, 10 Dec 2023 20:57:21 +0100 Subject: [PATCH] move lazyinit --- cmd/carapace/cmd/lazyInit.go | 271 ------------------------ cmd/carapace/cmd/lazyinit/bash.go | 30 +++ cmd/carapace/cmd/lazyinit/elvish.go | 20 ++ cmd/carapace/cmd/lazyinit/fish.go | 23 ++ cmd/carapace/cmd/lazyinit/lazyInit.go | 121 +++++++++++ cmd/carapace/cmd/lazyinit/nushell.go | 22 ++ cmd/carapace/cmd/lazyinit/oil.go | 18 ++ cmd/carapace/cmd/lazyinit/powershell.go | 24 +++ cmd/carapace/cmd/lazyinit/tcsh.go | 15 ++ cmd/carapace/cmd/lazyinit/xonsh.go | 30 +++ cmd/carapace/cmd/lazyinit/zsh.go | 17 ++ cmd/carapace/cmd/root.go | 21 +- 12 files changed, 331 insertions(+), 281 deletions(-) delete mode 100644 cmd/carapace/cmd/lazyInit.go create mode 100644 cmd/carapace/cmd/lazyinit/bash.go create mode 100644 cmd/carapace/cmd/lazyinit/elvish.go create mode 100644 cmd/carapace/cmd/lazyinit/fish.go create mode 100644 cmd/carapace/cmd/lazyinit/lazyInit.go create mode 100644 cmd/carapace/cmd/lazyinit/nushell.go create mode 100644 cmd/carapace/cmd/lazyinit/oil.go create mode 100644 cmd/carapace/cmd/lazyinit/powershell.go create mode 100644 cmd/carapace/cmd/lazyinit/tcsh.go create mode 100644 cmd/carapace/cmd/lazyinit/xonsh.go create mode 100644 cmd/carapace/cmd/lazyinit/zsh.go diff --git a/cmd/carapace/cmd/lazyInit.go b/cmd/carapace/cmd/lazyInit.go deleted file mode 100644 index ddf9201b6f..0000000000 --- a/cmd/carapace/cmd/lazyInit.go +++ /dev/null @@ -1,271 +0,0 @@ -package cmd - -//go:generate go run ../../carapace-generate/gen.go - -import ( - "fmt" - "os" - "runtime" - "strings" - - "github.com/rsteube/carapace" - "github.com/rsteube/carapace/pkg/xdg" -) - -func bash_lazy(completers []string) string { - snippet := `%v%v - -_carapace_lazy() { - source <(carapace $1 bash) - $"_$1_completion" -} -complete -F _carapace_lazy %v -` - return fmt.Sprintf(snippet, pathSnippet("bash"), envSnippet("bash"), strings.Join(completers, " ")) -} - -func bash_ble_lazy(completers []string) string { - snippet := `%v - -_carapace_lazy() { - source <(carapace $1 bash-ble) - $"_$1_completion_ble" -} -complete -F _carapace_lazy %v -` - return fmt.Sprintf(snippet, pathSnippet("bash-ble"), strings.Join(completers, " ")) -} - -func elvish_lazy(completers []string) string { - snippet := `%v - -put %v | each {|c| - set edit:completion:arg-completer[$c] = {|@arg| - set edit:completion:arg-completer[$c] = {|@arg| } - eval (carapace $c elvish | slurp) - $edit:completion:arg-completer[$c] $@arg - } -} -` - return fmt.Sprintf(snippet, pathSnippet("elvish"), strings.Join(completers, " ")) -} - -func pathSnippet(shell string) (snippet string) { - configDir, err := xdg.UserConfigDir() - if err != nil { - panic(err.Error()) - } - binDir := configDir + "/carapace/bin" - - switch shell { - case "bash", "bash-ble", "oil", "zsh": - snippet = fmt.Sprintf(`export PATH="%v%v$PATH"`, binDir, string(os.PathListSeparator)) - - case "elvish": - snippet = fmt.Sprintf(`set paths = ['%v' $@paths]`, binDir) - - case "fish": - snippet = fmt.Sprintf(`fish_add_path '%v'`, binDir) - - case "nushell": - fixedBinDir := strings.ReplaceAll(binDir, `\`, `\\`) - if runtime.GOOS == "windows" { - snippet = fmt.Sprintf(`$env.Path = ($env.Path | split row (char esep) | prepend "%v")`, fixedBinDir) - } else { - snippet = fmt.Sprintf(`$env.PATH = ($env.PATH | split row (char esep) | prepend "%v")`, fixedBinDir) - } - - case "powershell": - snippet = fmt.Sprintf(`[Environment]::SetEnvironmentVariable("PATH", "%v" + [IO.Path]::PathSeparator + [Environment]::GetEnvironmentVariable("PATH"))`, binDir) - - case "xonsh": - snippet = fmt.Sprintf(`__xonsh__.env['PATH'].insert(0, '%v')`, binDir) - - default: - snippet = fmt.Sprintf("# error: unknown shell: %#v", shell) - } - - for _, path := range strings.Split(os.Getenv("PATH"), string(os.PathListSeparator)) { - if path == binDir { - carapace.LOG.Printf("PATH already contains %#v\n", binDir) - if shell != "nushell" { - snippet = "# " + snippet - } - break - } - } - return -} - -func envSnippet(shell string) string { - if os.Getenv("CARAPACE_ENV") == "0" { - return "" - } - - switch shell { - case "bash", "oil": - return ` - -get-env () { echo "${!1}"; } -set-env () { export "$1=$2"; } -unset-env () { unset "$1"; }` - - case "fish": - return ` - -function get-env -d "get environment variable"; echo $$argv[1]; end -function set-env -d "set environment variable"; set -g -x $argv[1] $argv[2]; end -function unset-env -d "unset environment variable"; set -e $argv[1]; end` - - case "nushell": - return ` - -def --env get-env [name] { $env | get $name } -def --env set-env [name, value] { load-env { $name: $value } } -def --env unset-env [name] { hide-env $name }` - - case "powershell": - return ` - -Function get-env([string]$name) { Get-Item "env:$name" } -Function set-env([string]$name, [string]$value) { Set-Item "env:$name" "$value" } -Function unset-env([string]$name) { Remove-Item "env:$name" }` - - case "xonsh": - return ` - -def _carapace_getenv(args): - print(__xonsh__.env[args[0]]) -aliases['get-env']=_carapace_getenv - -def _carapace_setenv(args): - __xonsh__.env[args[0]]=args[1] - os.environ[args[0]]=args[1] -aliases['set-env']=_carapace_setenv - -def _carapace_unsetenv(args): - del __xonsh__.env[args[0]] - del os.environ[args[0]] -aliases['unset-env']=_carapace_unsetenv` - - case "zsh": - return ` - -get-env () { echo "${(P)1}"; } -set-env () { export "$1=$2"; } -unset-env () { unset "$1"; }` - - default: - return "" - } -} - -func fish_lazy(completers []string) string { - snippet := `%v%v - -function _carapace_lazy - complete -c $argv[1] -e - carapace $argv[1] fish | source - complete --do-complete=(commandline -cp) -end -%v -` - complete := make([]string, len(completers)) - for index, completer := range completers { - complete[index] = fmt.Sprintf(`complete -c '%v' -f -a '(_carapace_lazy %v)'`, completer, completer) - } - return fmt.Sprintf(snippet, pathSnippet("fish"), envSnippet("fish"), strings.Join(complete, "\n")) -} - -func nushell_lazy(completers []string) string { - snippet := `%v%v - -let carapace_completer = {|spans| - carapace $spans.0 nushell $spans | from json -} - -mut current = (($env | default {} config).config | default {} completions) -$current.completions = ($current.completions | default {} external) -$current.completions.external = ($current.completions.external - | default true enable - | default $carapace_completer completer) - -$env.config = $current - ` - - return fmt.Sprintf(snippet, pathSnippet("nushell"), envSnippet("nushell")) -} - -func oil_lazy(completers []string) string { - snippet := `%v%v - -_carapace_lazy() { - source <(carapace $1 oil) - $"_$1_completion" -} -complete -F _carapace_lazy %v -` - return fmt.Sprintf(snippet, pathSnippet("oil"), envSnippet("oil"), strings.Join(completers, " ")) -} - -func powershell_lazy(completers []string) string { - snippet := `%v%v - -$_carapace_lazy = { - param($wordToComplete, $commandAst, $cursorPosition) - $completer = $commandAst.CommandElements[0].Value - carapace $completer powershell | Out-String | Invoke-Expression - & (Get-Item "Function:_${completer}_completer") $wordToComplete $commandAst $cursorPosition -} -%v -` - complete := make([]string, len(completers)) - for index, completer := range completers { - complete[index] = fmt.Sprintf(`Register-ArgumentCompleter -Native -CommandName '%v' -ScriptBlock $_carapace_lazy`, completer) - } - return fmt.Sprintf(snippet, pathSnippet("powershell"), envSnippet("powershell"), strings.Join(complete, "\n")) -} - -func tcsh_lazy(completers []string) string { - // TODO hardcoded for now - snippet := make([]string, len(completers)) - for index, c := range completers { - snippet[index] = fmt.Sprintf("complete \"%v\" 'p@*@`echo \"$COMMAND_LINE'\"''\"'\" | xargs carapace %v tcsh `@@' ;", c, c) - } - return strings.Join(snippet, "\n") -} - -func xonsh_lazy(completers []string) string { - snippet := `from xonsh.completers._aliases import _add_one_completer -from xonsh.completers.tools import * -import os - -%v%v - -@contextual_completer -def _carapace_lazy(context): - """carapace lazy""" - if (context.command and - context.command.arg_index > 0 and - context.command.args[0].value in [%v]): - exec(compile(subprocess.run(['carapace', context.command.args[0].value, 'xonsh'], stdout=subprocess.PIPE).stdout.decode('utf-8'), "", "exec")) - return XSH.completers[context.command.args[0].value](context) -` - complete := make([]string, len(completers)) - for index, completer := range completers { - complete[index] = fmt.Sprintf(`'%v'`, completer) - } - snippet += `_add_one_completer('carapace_lazy', _carapace_lazy, 'start')` - return fmt.Sprintf(snippet, pathSnippet("xonsh"), envSnippet("xonsh"), strings.Join(complete, ", ")) -} - -func zsh_lazy(completers []string) string { - snippet := `%v%v - -function _carapace_lazy { - source <(carapace $words[1] zsh) -} -compdef _carapace_lazy %v -` - return fmt.Sprintf(snippet, pathSnippet("zsh"), envSnippet("zsh"), strings.Join(completers, " ")) -} diff --git a/cmd/carapace/cmd/lazyinit/bash.go b/cmd/carapace/cmd/lazyinit/bash.go new file mode 100644 index 0000000000..00dd2db5e6 --- /dev/null +++ b/cmd/carapace/cmd/lazyinit/bash.go @@ -0,0 +1,30 @@ +package lazyinit + +import ( + "fmt" + "strings" +) + +func Bash(completers []string) string { + snippet := `%v%v + +_carapace_lazy() { + source <(carapace $1 bash) + $"_$1_completion" +} +complete -F _carapace_lazy %v +` + return fmt.Sprintf(snippet, pathSnippet("bash"), envSnippet("bash"), strings.Join(completers, " ")) +} + +func BashBle(completers []string) string { + snippet := `%v + +_carapace_lazy() { + source <(carapace $1 bash-ble) + $"_$1_completion_ble" +} +complete -F _carapace_lazy %v +` + return fmt.Sprintf(snippet, pathSnippet("bash-ble"), strings.Join(completers, " ")) +} diff --git a/cmd/carapace/cmd/lazyinit/elvish.go b/cmd/carapace/cmd/lazyinit/elvish.go new file mode 100644 index 0000000000..a84629c6a4 --- /dev/null +++ b/cmd/carapace/cmd/lazyinit/elvish.go @@ -0,0 +1,20 @@ +package lazyinit + +import ( + "fmt" + "strings" +) + +func Elvish(completers []string) string { + snippet := `%v + +put %v | each {|c| + set edit:completion:arg-completer[$c] = {|@arg| + set edit:completion:arg-completer[$c] = {|@arg| } + eval (carapace $c elvish | slurp) + $edit:completion:arg-completer[$c] $@arg + } +} +` + return fmt.Sprintf(snippet, pathSnippet("elvish"), strings.Join(completers, " ")) +} diff --git a/cmd/carapace/cmd/lazyinit/fish.go b/cmd/carapace/cmd/lazyinit/fish.go new file mode 100644 index 0000000000..baa0970a75 --- /dev/null +++ b/cmd/carapace/cmd/lazyinit/fish.go @@ -0,0 +1,23 @@ +package lazyinit + +import ( + "fmt" + "strings" +) + +func Fish(completers []string) string { + snippet := `%v%v + +function _carapace_lazy + complete -c $argv[1] -e + carapace $argv[1] fish | source + complete --do-complete=(commandline -cp) +end +%v +` + complete := make([]string, len(completers)) + for index, completer := range completers { + complete[index] = fmt.Sprintf(`complete -c '%v' -f -a '(_carapace_lazy %v)'`, completer, completer) + } + return fmt.Sprintf(snippet, pathSnippet("fish"), envSnippet("fish"), strings.Join(complete, "\n")) +} diff --git a/cmd/carapace/cmd/lazyinit/lazyInit.go b/cmd/carapace/cmd/lazyinit/lazyInit.go new file mode 100644 index 0000000000..6cca85f22c --- /dev/null +++ b/cmd/carapace/cmd/lazyinit/lazyInit.go @@ -0,0 +1,121 @@ +package lazyinit + +import ( + "fmt" + "os" + "runtime" + "strings" + + "github.com/rsteube/carapace" + "github.com/rsteube/carapace/pkg/xdg" +) + +func pathSnippet(shell string) (snippet string) { + configDir, err := xdg.UserConfigDir() + if err != nil { + panic(err.Error()) + } + binDir := configDir + "/carapace/bin" + + switch shell { + case "bash", "bash-ble", "oil", "zsh": + snippet = fmt.Sprintf(`export PATH="%v%v$PATH"`, binDir, string(os.PathListSeparator)) + + case "elvish": + snippet = fmt.Sprintf(`set paths = ['%v' $@paths]`, binDir) + + case "fish": + snippet = fmt.Sprintf(`fish_add_path '%v'`, binDir) + + case "nushell": + fixedBinDir := strings.ReplaceAll(binDir, `\`, `\\`) + if runtime.GOOS == "windows" { + snippet = fmt.Sprintf(`$env.Path = ($env.Path | split row (char esep) | prepend "%v")`, fixedBinDir) + } else { + snippet = fmt.Sprintf(`$env.PATH = ($env.PATH | split row (char esep) | prepend "%v")`, fixedBinDir) + } + + case "powershell": + snippet = fmt.Sprintf(`[Environment]::SetEnvironmentVariable("PATH", "%v" + [IO.Path]::PathSeparator + [Environment]::GetEnvironmentVariable("PATH"))`, binDir) + + case "xonsh": + snippet = fmt.Sprintf(`__xonsh__.env['PATH'].insert(0, '%v')`, binDir) + + default: + snippet = fmt.Sprintf("# error: unknown shell: %#v", shell) + } + + for _, path := range strings.Split(os.Getenv("PATH"), string(os.PathListSeparator)) { + if path == binDir { + carapace.LOG.Printf("PATH already contains %#v\n", binDir) + if shell != "nushell" { + snippet = "# " + snippet + } + break + } + } + return +} + +func envSnippet(shell string) string { + if os.Getenv("CARAPACE_ENV") == "0" { + return "" + } + + switch shell { + case "bash", "oil": + return ` + +get-env () { echo "${!1}"; } +set-env () { export "$1=$2"; } +unset-env () { unset "$1"; }` + + case "fish": + return ` + +function get-env -d "get environment variable"; echo $$argv[1]; end +function set-env -d "set environment variable"; set -g -x $argv[1] $argv[2]; end +function unset-env -d "unset environment variable"; set -e $argv[1]; end` + + case "nushell": + return ` + +def --env get-env [name] { $env | get $name } +def --env set-env [name, value] { load-env { $name: $value } } +def --env unset-env [name] { hide-env $name }` + + case "powershell": + return ` + +Function get-env([string]$name) { Get-Item "env:$name" } +Function set-env([string]$name, [string]$value) { Set-Item "env:$name" "$value" } +Function unset-env([string]$name) { Remove-Item "env:$name" }` + + case "xonsh": + return ` + +def _carapace_getenv(args): + print(__xonsh__.env[args[0]]) +aliases['get-env']=_carapace_getenv + +def _carapace_setenv(args): + __xonsh__.env[args[0]]=args[1] + os.environ[args[0]]=args[1] +aliases['set-env']=_carapace_setenv + +def _carapace_unsetenv(args): + del __xonsh__.env[args[0]] + del os.environ[args[0]] +aliases['unset-env']=_carapace_unsetenv` + + case "zsh": + return ` + +get-env () { echo "${(P)1}"; } +set-env () { export "$1=$2"; } +unset-env () { unset "$1"; }` + + default: + return "" + } +} diff --git a/cmd/carapace/cmd/lazyinit/nushell.go b/cmd/carapace/cmd/lazyinit/nushell.go new file mode 100644 index 0000000000..9380a4b518 --- /dev/null +++ b/cmd/carapace/cmd/lazyinit/nushell.go @@ -0,0 +1,22 @@ +package lazyinit + +import "fmt" + +func Nushell(completers []string) string { + snippet := `%v%v + +let carapace_completer = {|spans| + carapace $spans.0 nushell $spans | from json +} + +mut current = (($env | default {} config).config | default {} completions) +$current.completions = ($current.completions | default {} external) +$current.completions.external = ($current.completions.external + | default true enable + | default $carapace_completer completer) + +$env.config = $current + ` + + return fmt.Sprintf(snippet, pathSnippet("nushell"), envSnippet("nushell")) +} diff --git a/cmd/carapace/cmd/lazyinit/oil.go b/cmd/carapace/cmd/lazyinit/oil.go new file mode 100644 index 0000000000..2396af1106 --- /dev/null +++ b/cmd/carapace/cmd/lazyinit/oil.go @@ -0,0 +1,18 @@ +package lazyinit + +import ( + "fmt" + "strings" +) + +func Oil(completers []string) string { + snippet := `%v%v + +_carapace_lazy() { + source <(carapace $1 oil) + $"_$1_completion" +} +complete -F _carapace_lazy %v +` + return fmt.Sprintf(snippet, pathSnippet("oil"), envSnippet("oil"), strings.Join(completers, " ")) +} diff --git a/cmd/carapace/cmd/lazyinit/powershell.go b/cmd/carapace/cmd/lazyinit/powershell.go new file mode 100644 index 0000000000..6906f91b06 --- /dev/null +++ b/cmd/carapace/cmd/lazyinit/powershell.go @@ -0,0 +1,24 @@ +package lazyinit + +import ( + "fmt" + "strings" +) + +func Powershell(completers []string) string { + snippet := `%v%v + +$_carapace_lazy = { + param($wordToComplete, $commandAst, $cursorPosition) + $completer = $commandAst.CommandElements[0].Value + carapace $completer powershell | Out-String | Invoke-Expression + & (Get-Item "Function:_${completer}_completer") $wordToComplete $commandAst $cursorPosition +} +%v +` + complete := make([]string, len(completers)) + for index, completer := range completers { + complete[index] = fmt.Sprintf(`Register-ArgumentCompleter -Native -CommandName '%v' -ScriptBlock $_carapace_lazy`, completer) + } + return fmt.Sprintf(snippet, pathSnippet("powershell"), envSnippet("powershell"), strings.Join(complete, "\n")) +} diff --git a/cmd/carapace/cmd/lazyinit/tcsh.go b/cmd/carapace/cmd/lazyinit/tcsh.go new file mode 100644 index 0000000000..2e3ae7b18d --- /dev/null +++ b/cmd/carapace/cmd/lazyinit/tcsh.go @@ -0,0 +1,15 @@ +package lazyinit + +import ( + "fmt" + "strings" +) + +func Tcsh(completers []string) string { + // TODO hardcoded for now + snippet := make([]string, len(completers)) + for index, c := range completers { + snippet[index] = fmt.Sprintf("complete \"%v\" 'p@*@`echo \"$COMMAND_LINE'\"''\"'\" | xargs carapace %v tcsh `@@' ;", c, c) + } + return strings.Join(snippet, "\n") +} diff --git a/cmd/carapace/cmd/lazyinit/xonsh.go b/cmd/carapace/cmd/lazyinit/xonsh.go new file mode 100644 index 0000000000..60e19fcdc5 --- /dev/null +++ b/cmd/carapace/cmd/lazyinit/xonsh.go @@ -0,0 +1,30 @@ +package lazyinit + +import ( + "fmt" + "strings" +) + +func Xonsh(completers []string) string { + snippet := `from xonsh.completers._aliases import _add_one_completer +from xonsh.completers.tools import * +import os + +%v%v + +@contextual_completer +def _carapace_lazy(context): + """carapace lazy""" + if (context.command and + context.command.arg_index > 0 and + context.command.args[0].value in [%v]): + exec(compile(subprocess.run(['carapace', context.command.args[0].value, 'xonsh'], stdout=subprocess.PIPE).stdout.decode('utf-8'), "", "exec")) + return XSH.completers[context.command.args[0].value](context) +` + complete := make([]string, len(completers)) + for index, completer := range completers { + complete[index] = fmt.Sprintf(`'%v'`, completer) + } + snippet += `_add_one_completer('carapace_lazy', _carapace_lazy, 'start')` + return fmt.Sprintf(snippet, pathSnippet("xonsh"), envSnippet("xonsh"), strings.Join(complete, ", ")) +} diff --git a/cmd/carapace/cmd/lazyinit/zsh.go b/cmd/carapace/cmd/lazyinit/zsh.go new file mode 100644 index 0000000000..eb32184eb2 --- /dev/null +++ b/cmd/carapace/cmd/lazyinit/zsh.go @@ -0,0 +1,17 @@ +package lazyinit + +import ( + "fmt" + "strings" +) + +func Zsh(completers []string) string { + snippet := `%v%v + +function _carapace_lazy { + source <(carapace $words[1] zsh) +} +compdef _carapace_lazy %v +` + return fmt.Sprintf(snippet, pathSnippet("zsh"), envSnippet("zsh"), strings.Join(completers, " ")) +} diff --git a/cmd/carapace/cmd/root.go b/cmd/carapace/cmd/root.go index 625dfaf5d8..0363bd14bc 100644 --- a/cmd/carapace/cmd/root.go +++ b/cmd/carapace/cmd/root.go @@ -16,6 +16,7 @@ import ( "github.com/rsteube/carapace" "github.com/rsteube/carapace-bin/cmd/carapace/cmd/completers" + "github.com/rsteube/carapace-bin/cmd/carapace/cmd/lazyinit" "github.com/rsteube/carapace-bin/cmd/carapace/cmd/shim" "github.com/rsteube/carapace-bin/pkg/actions" spec "github.com/rsteube/carapace-spec" @@ -140,25 +141,25 @@ var rootCmd = &cobra.Command{ switch shell { case "bash": - fmt.Fprintln(cmd.OutOrStdout(), bash_lazy(completers)) + fmt.Fprintln(cmd.OutOrStdout(), lazyinit.Bash(completers)) case "bash-ble": - fmt.Fprintln(cmd.OutOrStdout(), bash_ble_lazy(completers)) + fmt.Fprintln(cmd.OutOrStdout(), lazyinit.BashBle(completers)) case "elvish": - fmt.Fprintln(cmd.OutOrStdout(), elvish_lazy(completers)) + fmt.Fprintln(cmd.OutOrStdout(), lazyinit.Elvish(completers)) case "fish": - fmt.Fprintln(cmd.OutOrStdout(), fish_lazy(completers)) + fmt.Fprintln(cmd.OutOrStdout(), lazyinit.Fish(completers)) case "nushell": - fmt.Fprintln(cmd.OutOrStdout(), nushell_lazy(completers)) + fmt.Fprintln(cmd.OutOrStdout(), lazyinit.Nushell(completers)) case "oil": - fmt.Fprintln(cmd.OutOrStdout(), oil_lazy(completers)) + fmt.Fprintln(cmd.OutOrStdout(), lazyinit.Oil(completers)) case "powershell": - fmt.Fprintln(cmd.OutOrStdout(), powershell_lazy(completers)) + fmt.Fprintln(cmd.OutOrStdout(), lazyinit.Powershell(completers)) case "tcsh": - fmt.Fprintln(cmd.OutOrStdout(), tcsh_lazy(completers)) + fmt.Fprintln(cmd.OutOrStdout(), lazyinit.Tcsh(completers)) case "xonsh": - fmt.Fprintln(cmd.OutOrStdout(), xonsh_lazy(completers)) + fmt.Fprintln(cmd.OutOrStdout(), lazyinit.Xonsh(completers)) case "zsh": - fmt.Fprintln(cmd.OutOrStdout(), zsh_lazy(completers)) + fmt.Fprintln(cmd.OutOrStdout(), lazyinit.Zsh(completers)) default: fmt.Fprintln(os.Stderr, "could not determine shell") }