Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 16 additions & 14 deletions internal/cli/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,20 +243,22 @@ func TestVersion(t *testing.T) {
}
})

t.Run("json output", func(t *testing.T) {
t.Parallel()
out := mustRunCMD(t, "version", "-o", "json")
var info versionInfo
if err := json.Unmarshal([]byte(out), &info); err != nil {
t.Fatalf("json.Unmarshal(version output) error = %v", err)
}
if info.Version == "" {
t.Fatalf("a2a version info.Version = %q, want non-empty", info.Version)
}
if info.GoVersion == "" {
t.Fatalf("a2a version info.GoVersion = %q, want non-empty", info.GoVersion)
}
})
for _, mode := range []string{"json", "jsonl"} {
t.Run(mode+" output", func(t *testing.T) {
t.Parallel()
out := mustRunCMD(t, "version", "-o", mode)
var info versionInfo
if err := json.Unmarshal([]byte(out), &info); err != nil {
t.Fatalf("json.Unmarshal(version output) error = %v", err)
}
if info.Version == "" {
t.Fatalf("a2a version info.Version = %q, want non-empty", info.Version)
}
if info.GoVersion == "" {
t.Fatalf("a2a version info.GoVersion = %q, want non-empty", info.GoVersion)
}
})
}
}

func TestSkill(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion internal/cli/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func newVersionCmd(cfg *globalConfig) *cobra.Command {
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
info := buildVersionInfo()
if cfg.output == "json" {
if cfg.IsJSON() {
return cfg.PrintJSON(info)
}
_, err := fmt.Fprintf(
Expand Down
Loading