diff options
Diffstat (limited to 'makeAutocompleteFiles.go')
| -rw-r--r-- | makeAutocompleteFiles.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/makeAutocompleteFiles.go b/makeAutocompleteFiles.go index 647abe3..57bf391 100644 --- a/makeAutocompleteFiles.go +++ b/makeAutocompleteFiles.go @@ -12,6 +12,22 @@ import ( "go.wit.com/log" ) +func detectShell() string { + // Zsh sets ZSH_VERSION. We use os.LookupEnv which returns a boolean + // indicating if the variable is present. + if _, ok := os.LookupEnv("ZSH_VERSION"); ok { + return "zsh" + } + + // Bash sets BASH_VERSION. + if _, ok := os.LookupEnv("BASH_VERSION"); ok { + return "bash" + } + + // Fallback if neither is found. + return "unknown" +} + // makes a autocomplete file for your command func makeAutocompleteFiles(argname string) { fmt.Println(makeBashCompletionText2(argname)) |
