diff options
| author | Paul Buetow <paul@buetow.org> | 2025-09-28 20:04:52 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2025-09-28 20:04:52 +0300 |
| commit | 6103208e0fd382fb5f8c3e317fa28d888d42cb2b (patch) | |
| tree | 9806badfb4f506c2bcf3f6b2e0bf10c52f117dba /cmd/hexai-lsp/main.go | |
| parent | 42ad1a5ef6372e9117c343d728c7a840105e4400 (diff) | |
Document config defaults in CLI help
Diffstat (limited to 'cmd/hexai-lsp/main.go')
| -rw-r--r-- | cmd/hexai-lsp/main.go | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/cmd/hexai-lsp/main.go b/cmd/hexai-lsp/main.go index 9764f0b..3704cbf 100644 --- a/cmd/hexai-lsp/main.go +++ b/cmd/hexai-lsp/main.go @@ -3,17 +3,20 @@ package main import ( "flag" + "fmt" "log" "os" "strings" "codeberg.org/snonux/hexai/internal" + "codeberg.org/snonux/hexai/internal/appconfig" "codeberg.org/snonux/hexai/internal/hexailsp" ) func main() { logPath := flag.String("log", "/tmp/hexai-lsp.log", "path to log file (optional)") - configPath := flag.String("config", "", "path to config file") + defaultCfg := defaultConfigPath() + configPath := flag.String("config", "", fmt.Sprintf("path to config file (default: %s)", defaultCfg)) showVersion := flag.Bool("version", false, "print version and exit") flag.Parse() if *showVersion { @@ -26,3 +29,11 @@ func main() { log.Fatalf("server error: %v", err) } } + +func defaultConfigPath() string { + path, err := appconfig.ConfigPath() + if err != nil { + return "$XDG_CONFIG_HOME/hexai/config.toml" + } + return path +} |
