diff options
Diffstat (limited to 'cmd')
| -rw-r--r-- | cmd/ship/main.go | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/cmd/ship/main.go b/cmd/ship/main.go index f7d95c1..73d9a20 100644 --- a/cmd/ship/main.go +++ b/cmd/ship/main.go | |||
| @@ -6,8 +6,20 @@ import ( | |||
| 6 | ) | 6 | ) |
| 7 | 7 | ||
| 8 | func main() { | 8 | func main() { |
| 9 | if err := rootCmd.Execute(); err != nil { | 9 | // Use v2 (agent-first JSON) interface by default |
| 10 | fmt.Fprintf(os.Stderr, "Error: %v\n", err) | 10 | // Set SHIP_V1=1 to use legacy human-formatted output |
| 11 | if os.Getenv("SHIP_V1") == "1" { | ||
| 12 | if err := rootCmd.Execute(); err != nil { | ||
| 13 | fmt.Fprintf(os.Stderr, "Error: %v\n", err) | ||
| 14 | os.Exit(1) | ||
| 15 | } | ||
| 16 | return | ||
| 17 | } | ||
| 18 | |||
| 19 | // v2: JSON output by default | ||
| 20 | initV2() | ||
| 21 | if err := rootV2Cmd.Execute(); err != nil { | ||
| 22 | // Error already printed as JSON by commands | ||
| 11 | os.Exit(1) | 23 | os.Exit(1) |
| 12 | } | 24 | } |
| 13 | } | 25 | } |
