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/status.go | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 cmd/ship/status.go (limited to 'cmd/ship/status.go') diff --git a/cmd/ship/status.go b/cmd/ship/status.go new file mode 100644 index 0000000..03c548b --- /dev/null +++ b/cmd/ship/status.go @@ -0,0 +1,60 @@ +package main + +import ( + "fmt" + + "github.com/bdw/ship/internal/ssh" + "github.com/bdw/ship/internal/state" + "github.com/spf13/cobra" +) + +var statusCmd = &cobra.Command{ + Use: "status ", + Short: "Check status of a deployment", + Args: cobra.ExactArgs(1), + RunE: runStatus, +} + +func runStatus(cmd *cobra.Command, args []string) error { + name := args[0] + + 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") + } + + app, err := st.GetApp(host, name) + if err != nil { + return err + } + + if app.Type != "app" { + return fmt.Errorf("status is only available for apps, not static sites") + } + + client, err := ssh.Connect(host) + if err != nil { + return fmt.Errorf("error connecting to VPS: %w", err) + } + defer client.Close() + + output, err := client.RunSudo(fmt.Sprintf("systemctl status %s", name)) + if err != nil { + // systemctl status returns non-zero for non-active services + // but we still want to show the output + fmt.Print(output) + return nil + } + + fmt.Print(output) + return nil +} -- cgit v1.2.3