Skip to content

Commit

Permalink
fix: cmd stdout print and server alias for version
Browse files Browse the repository at this point in the history
  • Loading branch information
tazarov committed Mar 8, 2024
1 parent 19da0e1 commit 445e032
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package cmd

import (
"context"
"fmt"
"os"

"github.com/spf13/cobra"
Expand All @@ -13,21 +12,21 @@ var VersionCommand = &cobra.Command{
Aliases: []string{"v"},
Short: "Get the version of the Chroma Server",
Run: func(cmd *cobra.Command, args []string) {
client, err := getClient("")
client, err := getClient(alias)
if err != nil {
fmt.Printf("%v\n", err)
cmd.Printf("%v\n", err)
os.Exit(1)
}
version, err := client.Version(context.TODO())
if err != nil {
fmt.Printf("%v\n", err)
cmd.Printf("%v\n", err)
os.Exit(1)
}
cmd.Printf("Chroma Server Version: %v\n", version)
},
}

func init() {
VersionCommand.PersistentFlags().StringP("alias", "s", "", "Server alias")
VersionCommand.Flags().StringVarP(&alias, "alias", "s", "", "Server alias")
rootCmd.AddCommand(VersionCommand)
}

0 comments on commit 445e032

Please sign in to comment.