diff options
| author | Clawd <ai@clawd.bot> | 2026-02-17 08:11:19 -0800 |
|---|---|---|
| committer | Clawd <ai@clawd.bot> | 2026-02-17 08:11:19 -0800 |
| commit | 6f02ec84a8299fc5577f147cc8741c8a4b162b64 (patch) | |
| tree | 020f3690e92732dcba723be0cfaef649f46de137 /cmd/ship/list.go | |
| parent | 4b5a2656df13181b637c59c29ff31751e11cf22a (diff) | |
| parent | 05ea98df57599775c1d5bfea336012b075531670 (diff) | |
Merge agent-mode: v2 rewrite complete
- Removed all v1 code (-2800 lines)
- Simplified state to just default_host + base_domain
- Atomic port allocation via flock
- --container-port flag for Docker
- Custom domains shown in ship list
- Caddyfiles preserved on redeploy
- JSON output by default, --pretty for humans
Diffstat (limited to 'cmd/ship/list.go')
| -rw-r--r-- | cmd/ship/list.go | 61 |
1 files changed, 0 insertions, 61 deletions
diff --git a/cmd/ship/list.go b/cmd/ship/list.go deleted file mode 100644 index af5baf8..0000000 --- a/cmd/ship/list.go +++ /dev/null | |||
| @@ -1,61 +0,0 @@ | |||
| 1 | package main | ||
| 2 | |||
| 3 | import ( | ||
| 4 | "fmt" | ||
| 5 | "os" | ||
| 6 | "text/tabwriter" | ||
| 7 | |||
| 8 | "github.com/bdw/ship/internal/state" | ||
| 9 | "github.com/spf13/cobra" | ||
| 10 | ) | ||
| 11 | |||
| 12 | var listCmd = &cobra.Command{ | ||
| 13 | Use: "list", | ||
| 14 | Short: "List all deployed apps and sites", | ||
| 15 | RunE: runList, | ||
| 16 | } | ||
| 17 | |||
| 18 | func runList(cmd *cobra.Command, args []string) error { | ||
| 19 | st, err := state.Load() | ||
| 20 | if err != nil { | ||
| 21 | return fmt.Errorf("error loading state: %w", err) | ||
| 22 | } | ||
| 23 | |||
| 24 | host := hostFlag | ||
| 25 | if host == "" { | ||
| 26 | host = st.GetDefaultHost() | ||
| 27 | } | ||
| 28 | |||
| 29 | if host == "" { | ||
| 30 | return fmt.Errorf("--host is required") | ||
| 31 | } | ||
| 32 | |||
| 33 | apps := st.ListApps(host) | ||
| 34 | if len(apps) == 0 { | ||
| 35 | fmt.Printf("No deployments found for %s\n", host) | ||
| 36 | return nil | ||
| 37 | } | ||
| 38 | |||
| 39 | w := tabwriter.NewWriter(os.Stdout, 0, 0, 3, ' ', 0) | ||
| 40 | fmt.Fprintln(w, "NAME\tTYPE\tVISIBILITY\tDOMAIN\tPORT") | ||
| 41 | for name, app := range apps { | ||
| 42 | port := "" | ||
| 43 | if app.Type == "app" || app.Type == "git-app" { | ||
| 44 | port = fmt.Sprintf(":%d", app.Port) | ||
| 45 | } | ||
| 46 | domain := app.Domain | ||
| 47 | if domain == "" { | ||
| 48 | domain = "-" | ||
| 49 | } | ||
| 50 | visibility := "" | ||
| 51 | if app.Repo != "" { | ||
| 52 | visibility = "private" | ||
| 53 | if app.Public { | ||
| 54 | visibility = "public" | ||
| 55 | } | ||
| 56 | } | ||
| 57 | fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\n", name, app.Type, visibility, domain, port) | ||
| 58 | } | ||
| 59 | w.Flush() | ||
| 60 | return nil | ||
| 61 | } | ||
