From da160fbdfb30a55a4d617553baeb5b0a5a9d5fb8 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Thu, 12 Feb 2026 09:33:49 +0200 Subject: Rename hexai-lsp command to hexai-lsp-server Amp-Thread-ID: https://ampcode.com/threads/T-019c50bc-2906-77db-a31e-0d553338d99b Co-authored-by: Amp --- cmd/hexai-lsp/main.go | 52 ---------------------------------------------- cmd/hexai-lsp/main_test.go | 22 -------------------- 2 files changed, 74 deletions(-) delete mode 100644 cmd/hexai-lsp/main.go delete mode 100644 cmd/hexai-lsp/main_test.go (limited to 'cmd/hexai-lsp') diff --git a/cmd/hexai-lsp/main.go b/cmd/hexai-lsp/main.go deleted file mode 100644 index 828d0f8..0000000 --- a/cmd/hexai-lsp/main.go +++ /dev/null @@ -1,52 +0,0 @@ -// Summary: Hexai LSP entrypoint; parses flags and delegates to internal/hexailsp. -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() { - defaultLog := defaultLogPath() - logPath := flag.String("log", defaultLog, "path to log file (optional)") - 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 { - log.Println(internal.Version) - return - } - - path := strings.TrimSpace(*configPath) - if err := hexailsp.RunWithConfig(*logPath, path, os.Stdin, os.Stdout, os.Stderr); err != nil { - 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 -} - -// defaultLogPath returns the default LSP log file path in the state directory. -// Falls back to /tmp if state directory cannot be determined. -// defaultLogPath returns the default LSP log file path in the state directory. -// Panics if state directory cannot be created. -func defaultLogPath() string { - stateDir, err := appconfig.StateDir() - if err != nil { - panic(fmt.Sprintf("cannot create state directory: %v", err)) - } - return fmt.Sprintf("%s/hexai-lsp.log", stateDir) -} diff --git a/cmd/hexai-lsp/main_test.go b/cmd/hexai-lsp/main_test.go deleted file mode 100644 index 387b640..0000000 --- a/cmd/hexai-lsp/main_test.go +++ /dev/null @@ -1,22 +0,0 @@ -package main - -import ( - "bytes" - "log" - "os" - "testing" -) - -func TestMain_Version(t *testing.T) { - oldArgs := os.Args - defer func() { os.Args = oldArgs }() - os.Args = []string{"hexai-lsp", "-version"} - var buf bytes.Buffer - old := log.Writer() - log.SetOutput(&buf) - defer log.SetOutput(old) - main() - if buf.Len() == 0 { - t.Fatalf("expected version log") - } -} -- cgit v1.2.3