diff --git a/README.md b/README.md index e25c99a5cb84372414d68a63a511eba824ac9b76..c268cb7cedf4b80632dbd75458ad3db90900edf0 100644 --- a/README.md +++ b/README.md @@ -232,6 +232,11 @@ $HOME/.local/share/crush/crush.json %LOCALAPPDATA%\crush\crush.json ``` +> [!TIP] +> You can override the user and data config locations by setting: +> * `CRUSH_GLOBAL_CONFIG` +> * `CRUSH_GLOBAL_DATA` + ### LSPs Crush can use LSPs for additional context to help inform its decisions, just diff --git a/cspell.json b/cspell.json deleted file mode 100644 index 368a9d5094dc6ebd1850f118533dc41050b0eb90..0000000000000000000000000000000000000000 --- a/cspell.json +++ /dev/null @@ -1 +0,0 @@ -{"words":["afero","agentic","alecthomas","anthropics","aymanbagabas","azidentity","bmatcuk","bubbletea","charlievieth","charmbracelet","charmtone","Charple","chkconfig","crush","curlie","cursorrules","diffview","doas","Dockerfiles","doublestar","dpkg","Emph","fastwalk","fdisk","filepicker","Focusable","fseventsd","fsext","genai","goquery","GROQ","Guac","imageorient","Inex","jetta","jsons","jsonschema","jspm","Kaufmann","killall","Lanczos","lipgloss","LOCALAPPDATA","lsps","lucasb","makepkg","mcps","MSYS","mvdan","natefinch","nfnt","noctx","nohup","nolint","nslookup","oksvg","Oneshot","openrouter","opkg","pacman","paru","pfctl","postamble","postambles","preconfigured","Preproc","Proactiveness","Puerkito","pycache","pytest","qjebbs","rasterx","rivo","sabhiram","sess","shortlog","sjson","Sourcegraph","srwiley","SSEMCP","Streamable","stretchr","Strikethrough","substrs","Suscriber","systeminfo","tasklist","termenv","textinput","tidwall","timedout","trashhalo","udiff","uniseg","Unticked","urllib","USERPROFILE","VERTEXAI","webp","whatis","whereis","sahilm","csync","Highlightable","Highlightable","prerendered","prerender","kujtim","animatable"],"version":"0.2","flagWords":[],"language":"en"} \ No newline at end of file diff --git a/internal/config/load.go b/internal/config/load.go index 059f9da2a39833b70b3635f230b292bb49d5edc6..0d16702dcdd35eb7d431ddfe4a0b35ab48e4debc 100644 --- a/internal/config/load.go +++ b/internal/config/load.go @@ -1,6 +1,7 @@ package config import ( + "cmp" "context" "encoding/json" "fmt" @@ -695,19 +696,22 @@ func hasAWSCredentials(env env.Env) bool { // GlobalConfig returns the global configuration file path for the application. func GlobalConfig() string { - xdgConfigHome := os.Getenv("XDG_CONFIG_HOME") - if xdgConfigHome != "" { + if crushGlobal := os.Getenv("CRUSH_GLOBAL_CONFIG"); crushGlobal != "" { + return filepath.Join(crushGlobal, fmt.Sprintf("%s.json", appName)) + } + if xdgConfigHome := os.Getenv("XDG_CONFIG_HOME"); xdgConfigHome != "" { return filepath.Join(xdgConfigHome, appName, fmt.Sprintf("%s.json", appName)) } - return filepath.Join(home.Dir(), ".config", appName, fmt.Sprintf("%s.json", appName)) } // GlobalConfigData returns the path to the main data directory for the application. // this config is used when the app overrides configurations instead of updating the global config. func GlobalConfigData() string { - xdgDataHome := os.Getenv("XDG_DATA_HOME") - if xdgDataHome != "" { + if crushData := os.Getenv("CRUSH_GLOBAL_DATA"); crushData != "" { + return filepath.Join(crushData, fmt.Sprintf("%s.json", appName)) + } + if xdgDataHome := os.Getenv("XDG_DATA_HOME"); xdgDataHome != "" { return filepath.Join(xdgDataHome, appName, fmt.Sprintf("%s.json", appName)) } @@ -715,10 +719,10 @@ func GlobalConfigData() string { // for windows, it should be in `%LOCALAPPDATA%/crush/` // for linux and macOS, it should be in `$HOME/.local/share/crush/` if runtime.GOOS == "windows" { - localAppData := os.Getenv("LOCALAPPDATA") - if localAppData == "" { - localAppData = filepath.Join(os.Getenv("USERPROFILE"), "AppData", "Local") - } + localAppData := cmp.Or( + os.Getenv("LOCALAPPDATA"), + filepath.Join(os.Getenv("USERPROFILE"), "AppData", "Local"), + ) return filepath.Join(localAppData, appName, fmt.Sprintf("%s.json", appName)) } diff --git a/internal/tui/components/mcp/mcp.go b/internal/tui/components/mcp/mcp.go index 782a776c5eefb946e0b858f6711bc5ec0ac705fd..78763ac85fdbb5b75e281ef39289f490e6bde949 100644 --- a/internal/tui/components/mcp/mcp.go +++ b/internal/tui/components/mcp/mcp.go @@ -69,10 +69,18 @@ func RenderMCPList(opts RenderOptions) []string { case mcp.StateConnected: icon = t.ItemOnlineIcon if count := state.Counts.Tools; count > 0 { - extraContent = append(extraContent, t.S().Subtle.Render(fmt.Sprintf("%d tools", count))) + label := "tools" + if count == 1 { + label = "tool" + } + extraContent = append(extraContent, t.S().Subtle.Render(fmt.Sprintf("%d %s", count, label))) } if count := state.Counts.Prompts; count > 0 { - extraContent = append(extraContent, t.S().Subtle.Render(fmt.Sprintf("%d prompts", count))) + label := "prompts" + if count == 1 { + label = "prompt" + } + extraContent = append(extraContent, t.S().Subtle.Render(fmt.Sprintf("%d %s", count, label))) } case mcp.StateError: icon = t.ItemErrorIcon