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/main.go | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 cmd/ship/main.go (limited to 'cmd/ship/main.go') 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 @@ +package main + +import ( + "os" + + "github.com/bdw/ship/cmd/ship/env" + "github.com/bdw/ship/cmd/ship/host" + "github.com/spf13/cobra" +) + +var ( + // Persistent flags + hostFlag string + + // Version info (set via ldflags) + version = "dev" + commit = "none" + date = "unknown" +) + +var rootCmd = &cobra.Command{ + Use: "ship", + Short: "Ship apps and static sites to a VPS with automatic HTTPS", + Long: `ship - Ship apps and static sites to a VPS with automatic HTTPS + +A CLI tool for deploying applications and static sites to a VPS. +Uses Caddy for automatic HTTPS and systemd for service management.`, + RunE: runDeploy, + SilenceUsage: true, + SilenceErrors: true, +} + +func init() { + // Persistent flags available to all subcommands + rootCmd.PersistentFlags().StringVar(&hostFlag, "host", "", "VPS host (SSH config alias or user@host)") + + // Root command (deploy) flags + rootCmd.Flags().String("binary", "", "Path to Go binary (for app deployment)") + rootCmd.Flags().Bool("static", false, "Deploy as static site") + rootCmd.Flags().String("dir", ".", "Directory to deploy (for static sites)") + rootCmd.Flags().String("domain", "", "Domain name (required)") + rootCmd.Flags().String("name", "", "App name (default: inferred from binary or directory)") + rootCmd.Flags().Int("port", 0, "Port override (default: auto-allocate)") + rootCmd.Flags().StringArray("env", nil, "Environment variable (KEY=VALUE, can be specified multiple times)") + rootCmd.Flags().String("env-file", "", "Path to .env file") + rootCmd.Flags().String("args", "", "Arguments to pass to binary") + rootCmd.Flags().StringArray("file", nil, "Config file to upload to working directory (can be specified multiple times)") + + // Add subcommands + rootCmd.AddCommand(listCmd) + rootCmd.AddCommand(logsCmd) + rootCmd.AddCommand(statusCmd) + rootCmd.AddCommand(restartCmd) + rootCmd.AddCommand(removeCmd) + rootCmd.AddCommand(env.Cmd) + rootCmd.AddCommand(host.Cmd) + rootCmd.AddCommand(uiCmd) + rootCmd.AddCommand(versionCmd) +} + +func main() { + if err := rootCmd.Execute(); err != nil { + os.Exit(1) + } +} -- cgit v1.2.3