summaryrefslogtreecommitdiffstats
path: root/cmd/ship/main.go
diff options
context:
space:
mode:
authorbndw <ben@bdw.to>2026-01-24 09:48:34 -0800
committerbndw <ben@bdw.to>2026-01-24 09:48:34 -0800
commit5861e465a2ccf31d87ea25ac145770786f9cc96e (patch)
tree4ac6b57a06b46d8492717b235909f9e0db0b4f22 /cmd/ship/main.go
parentef37850c7090493cf2b26d2e565511fe23cc9bfc (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/ship/main.go')
-rw-r--r--cmd/ship/main.go65
1 files changed, 65 insertions, 0 deletions
diff --git a/cmd/ship/main.go b/cmd/ship/main.go
new file mode 100644
index 0000000..680ac58
--- /dev/null
+++ b/cmd/ship/main.go
@@ -0,0 +1,65 @@
1package main
2
3import (
4 "os"
5
6 "github.com/bdw/ship/cmd/ship/env"
7 "github.com/bdw/ship/cmd/ship/host"
8 "github.com/spf13/cobra"
9)
10
11var (
12 // Persistent flags
13 hostFlag string
14
15 // Version info (set via ldflags)
16 version = "dev"
17 commit = "none"
18 date = "unknown"
19)
20
21var rootCmd = &cobra.Command{
22 Use: "ship",
23 Short: "Ship apps and static sites to a VPS with automatic HTTPS",
24 Long: `ship - Ship apps and static sites to a VPS with automatic HTTPS
25
26A CLI tool for deploying applications and static sites to a VPS.
27Uses Caddy for automatic HTTPS and systemd for service management.`,
28 RunE: runDeploy,
29 SilenceUsage: true,
30 SilenceErrors: true,
31}
32
33func init() {
34 // Persistent flags available to all subcommands
35 rootCmd.PersistentFlags().StringVar(&hostFlag, "host", "", "VPS host (SSH config alias or user@host)")
36
37 // Root command (deploy) flags
38 rootCmd.Flags().String("binary", "", "Path to Go binary (for app deployment)")
39 rootCmd.Flags().Bool("static", false, "Deploy as static site")
40 rootCmd.Flags().String("dir", ".", "Directory to deploy (for static sites)")
41 rootCmd.Flags().String("domain", "", "Domain name (required)")
42 rootCmd.Flags().String("name", "", "App name (default: inferred from binary or directory)")
43 rootCmd.Flags().Int("port", 0, "Port override (default: auto-allocate)")
44 rootCmd.Flags().StringArray("env", nil, "Environment variable (KEY=VALUE, can be specified multiple times)")
45 rootCmd.Flags().String("env-file", "", "Path to .env file")
46 rootCmd.Flags().String("args", "", "Arguments to pass to binary")
47 rootCmd.Flags().StringArray("file", nil, "Config file to upload to working directory (can be specified multiple times)")
48
49 // Add subcommands
50 rootCmd.AddCommand(listCmd)
51 rootCmd.AddCommand(logsCmd)
52 rootCmd.AddCommand(statusCmd)
53 rootCmd.AddCommand(restartCmd)
54 rootCmd.AddCommand(removeCmd)
55 rootCmd.AddCommand(env.Cmd)
56 rootCmd.AddCommand(host.Cmd)
57 rootCmd.AddCommand(uiCmd)
58 rootCmd.AddCommand(versionCmd)
59}
60
61func main() {
62 if err := rootCmd.Execute(); err != nil {
63 os.Exit(1)
64 }
65}