summaryrefslogtreecommitdiffstats
path: root/cmd/ship/main.go
blob: 73d9a20d402df74862a07a775024713c71f441e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package main

import (
	"fmt"
	"os"
)

func main() {
	// Use v2 (agent-first JSON) interface by default
	// Set SHIP_V1=1 to use legacy human-formatted output
	if os.Getenv("SHIP_V1") == "1" {
		if err := rootCmd.Execute(); err != nil {
			fmt.Fprintf(os.Stderr, "Error: %v\n", err)
			os.Exit(1)
		}
		return
	}

	// v2: JSON output by default
	initV2()
	if err := rootV2Cmd.Execute(); err != nil {
		// Error already printed as JSON by commands
		os.Exit(1)
	}
}