From 182240f8145029cfa39a274224478c095cebd919 Mon Sep 17 00:00:00 2001 From: Tugdual Saunier Date: Mon, 1 Jul 2024 12:46:03 +0200 Subject: [PATCH] Export GuessShell --- completion_installer.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/completion_installer.go b/completion_installer.go index d95beec..f94de50 100644 --- a/completion_installer.go +++ b/completion_installer.go @@ -70,9 +70,9 @@ Add this to the end of your shell configuration file (e.g. "{{ call .RcFil CompletionFile func() string }{ Command: command, - Shell: guessShell, + Shell: GuessShell, RcFile: func() string { - switch guessShell() { + switch GuessShell() { case "fish": return "~/.config/fish/config.fish" case "zsh": @@ -82,7 +82,7 @@ Add this to the end of your shell configuration file (e.g. "{{ call .RcFil } }, CompletionFile: func() string { - switch guessShell() { + switch GuessShell() { case "fish": return fmt.Sprintf("/etc/fish/completions/%s.fish", application.HelpName) case "zsh": @@ -107,7 +107,7 @@ Add this to the end of your shell configuration file (e.g. "{{ call .RcFil Action: func(c *Context) error { shell := c.Args().Get("shell") if shell == "" { - shell = guessShell() + shell = GuessShell() } templates, err := template.ParseFS(CompletionTemplates, "resources/*") @@ -136,6 +136,6 @@ Add this to the end of your shell configuration file (e.g. "{{ call .RcFil }, } -func guessShell() string { +func GuessShell() string { return path.Base(os.Getenv("SHELL")) }