diff options
| author | bndw <ben@bdw.to> | 2026-01-24 09:48:34 -0800 |
|---|---|---|
| committer | bndw <ben@bdw.to> | 2026-01-24 09:48:34 -0800 |
| commit | 5861e465a2ccf31d87ea25ac145770786f9cc96e (patch) | |
| tree | 4ac6b57a06b46d8492717b235909f9e0db0b4f22 /cmd/deploy/list.go | |
| parent | ef37850c7090493cf2b26d2e565511fe23cc9bfc (diff) | |
Rename project from deploy to ship
- Rename module to github.com/bdw/ship
- Rename cmd/deploy to cmd/ship
- Update all import paths
- Update config path from ~/.config/deploy to ~/.config/ship
- Update VPS env path from /etc/deploy to /etc/ship
- Update README, Makefile, and docs
Diffstat (limited to 'cmd/deploy/list.go')
| -rw-r--r-- | cmd/deploy/list.go | 50 |
1 files changed, 0 insertions, 50 deletions
diff --git a/cmd/deploy/list.go b/cmd/deploy/list.go deleted file mode 100644 index ab19a12..0000000 --- a/cmd/deploy/list.go +++ /dev/null | |||
| @@ -1,50 +0,0 @@ | |||
| 1 | package main | ||
| 2 | |||
| 3 | import ( | ||
| 4 | "fmt" | ||
| 5 | "os" | ||
| 6 | "text/tabwriter" | ||
| 7 | |||
| 8 | "github.com/bdw/deploy/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\tDOMAIN\tPORT") | ||
| 41 | for name, app := range apps { | ||
| 42 | port := "" | ||
| 43 | if app.Type == "app" { | ||
| 44 | port = fmt.Sprintf(":%d", app.Port) | ||
| 45 | } | ||
| 46 | fmt.Fprintf(w, "%s\t%s\t%s\t%s\n", name, app.Type, app.Domain, port) | ||
| 47 | } | ||
| 48 | w.Flush() | ||
| 49 | return nil | ||
| 50 | } | ||
