mirror of
https://github.com/cheat/cheat.git
synced 2026-03-07 03:03:32 +01:00
Replace docopt-go with spf13/cobra, giving cheat a built-in `--completion` flag that dynamically generates shell completions for bash, zsh, fish, and powershell. This replaces the manually-maintained static completion scripts and resolves the root cause of multiple completion issues (#768, #705, #633, #632, #476). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
21 lines
380 B
Go
21 lines
380 B
Go
package config
|
|
|
|
import (
|
|
"os"
|
|
"runtime"
|
|
"strings"
|
|
)
|
|
|
|
// EnvVars reads environment variables into a map of strings.
|
|
func EnvVars() map[string]string {
|
|
envvars := map[string]string{}
|
|
for _, e := range os.Environ() {
|
|
pair := strings.SplitN(e, "=", 2)
|
|
if runtime.GOOS == "windows" {
|
|
pair[0] = strings.ToUpper(pair[0])
|
|
}
|
|
envvars[pair[0]] = pair[1]
|
|
}
|
|
return envvars
|
|
}
|