From 5861e465a2ccf31d87ea25ac145770786f9cc96e Mon Sep 17 00:00:00 2001 From: bndw Date: Sat, 24 Jan 2026 09:48:34 -0800 Subject: 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 --- cmd/ship/list.go | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 cmd/ship/list.go (limited to 'cmd/ship/list.go') diff --git a/cmd/ship/list.go b/cmd/ship/list.go new file mode 100644 index 0000000..a5b8df3 --- /dev/null +++ b/cmd/ship/list.go @@ -0,0 +1,50 @@ +package main + +import ( + "fmt" + "os" + "text/tabwriter" + + "github.com/bdw/ship/internal/state" + "github.com/spf13/cobra" +) + +var listCmd = &cobra.Command{ + Use: "list", + Short: "List all deployed apps and sites", + RunE: runList, +} + +func runList(cmd *cobra.Command, args []string) error { + st, err := state.Load() + if err != nil { + return fmt.Errorf("error loading state: %w", err) + } + + host := hostFlag + if host == "" { + host = st.GetDefaultHost() + } + + if host == "" { + return fmt.Errorf("--host is required") + } + + apps := st.ListApps(host) + if len(apps) == 0 { + fmt.Printf("No deployments found for %s\n", host) + return nil + } + + w := tabwriter.NewWriter(os.Stdout, 0, 0, 3, ' ', 0) + fmt.Fprintln(w, "NAME\tTYPE\tDOMAIN\tPORT") + for name, app := range apps { + port := "" + if app.Type == "app" { + port = fmt.Sprintf(":%d", app.Port) + } + fmt.Fprintf(w, "%s\t%s\t%s\t%s\n", name, app.Type, app.Domain, port) + } + w.Flush() + return nil +} -- cgit v1.2.3