fix --version output (#128)

Signed-off-by: Rui Chen <rui@chenrui.dev>
This commit is contained in:
Rui Chen
2025-09-02 06:53:37 -04:00
committed by GitHub
parent cc1ab91e64
commit 433bdece70
+8
View File
@@ -2,6 +2,7 @@ package main
import (
"context"
"fmt"
"os"
"github.com/charmbracelet/fang"
@@ -11,6 +12,13 @@ import (
var version = "dev"
func main() {
for _, arg := range os.Args[1:] {
if arg == "--version" || arg == "-v" {
fmt.Printf("mcphost version %s\n", version)
os.Exit(0)
}
}
rootCmd := cmd.GetRootCommand(version)
if err := fang.Execute(context.Background(), rootCmd); err != nil {
os.Exit(1)