From 08f2fd3136dfb221aa607358a1b9846510188f61 Mon Sep 17 00:00:00 2001 From: Nate Meyer <672246+notnmeyer@users.noreply.github.com> Date: Fri, 20 Mar 2026 19:47:33 -0700 Subject: [PATCH] Revert "chore(loo-4749): `version` command (#22)" This reverts commit 427ca4d3bbfecd241ba091ffe64bbc5cb41f7725. --- .goreleaser.yaml | 5 ----- cmd/version.go | 38 -------------------------------------- cmd/version_test.go | 42 ------------------------------------------ 3 files changed, 85 deletions(-) delete mode 100644 cmd/version.go delete mode 100644 cmd/version_test.go diff --git a/.goreleaser.yaml b/.goreleaser.yaml index a8bc190..f4748aa 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -17,11 +17,6 @@ builds: - linux - windows - darwin - ldflags: - - -s -w - - -X github.com/loops-so/cli/cmd.version={{.Version}} - - -X github.com/loops-so/cli/cmd.commit={{.Commit}} - - -X github.com/loops-so/cli/cmd.date={{.Date}} archives: - formats: [tar.gz] diff --git a/cmd/version.go b/cmd/version.go deleted file mode 100644 index 5579c48..0000000 --- a/cmd/version.go +++ /dev/null @@ -1,38 +0,0 @@ -package cmd - -import ( - "fmt" - "io" - - "github.com/spf13/cobra" -) - -var ( - version = "dev" - commit = "none" - date = "unknown" -) - -var versionCmd = &cobra.Command{ - Use: "version", - Short: "Print version information", - RunE: func(cmd *cobra.Command, args []string) error { - return runVersion(cmd.OutOrStdout()) - }, -} - -func runVersion(w io.Writer) error { - if isJSONOutput() { - return printJSON(w, struct { - Version string `json:"version"` - Commit string `json:"commit"` - Date string `json:"date"` - }{version, commit, date}) - } - fmt.Fprintf(w, "loops version %s (commit: %s, built: %s)\n", version, commit, date) - return nil -} - -func init() { - rootCmd.AddCommand(versionCmd) -} diff --git a/cmd/version_test.go b/cmd/version_test.go deleted file mode 100644 index 8667363..0000000 --- a/cmd/version_test.go +++ /dev/null @@ -1,42 +0,0 @@ -package cmd - -import ( - "bytes" - "encoding/json" - "strings" - "testing" -) - -func TestRunVersion_Text(t *testing.T) { - outputFormat = "text" - var buf bytes.Buffer - if err := runVersion(&buf); err != nil { - t.Fatal(err) - } - got := buf.String() - if !strings.HasPrefix(got, "loops version ") { - t.Errorf("unexpected output: %q", got) - } -} - -func TestRunVersion_JSON(t *testing.T) { - outputFormat = "json" - t.Cleanup(func() { outputFormat = "text" }) - - var buf bytes.Buffer - if err := runVersion(&buf); err != nil { - t.Fatal(err) - } - - var got struct { - Version string `json:"version"` - Commit string `json:"commit"` - Date string `json:"date"` - } - if err := json.Unmarshal(buf.Bytes(), &got); err != nil { - t.Fatalf("invalid JSON: %v", err) - } - if got.Version == "" { - t.Error("version field is empty") - } -}