summaryrefslogtreecommitdiff
path: root/cmd/hexai-lsp/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/hexai-lsp/main.go')
-rw-r--r--cmd/hexai-lsp/main.go13
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
+}