From 1694ba1b8ad68e2d2ad21c1442c29b6f3f2c1632 Mon Sep 17 00:00:00 2001 From: bndw Date: Fri, 23 Jan 2026 21:19:50 -0800 Subject: Make deploy the default action and require --binary - Remove "deploy" subcommand, deploy is now the default action - Require --binary flag explicitly (no auto-discovery) - Add "rm" as alias for "remove" - Update help text --- cmd/deploy/deploy.go | 25 +++++++------------------ cmd/deploy/main.go | 30 +++++++++++++----------------- 2 files changed, 20 insertions(+), 35 deletions(-) (limited to 'cmd') diff --git a/cmd/deploy/deploy.go b/cmd/deploy/deploy.go index ee7ee4a..31aabe5 100644 --- a/cmd/deploy/deploy.go +++ b/cmd/deploy/deploy.go @@ -78,26 +78,15 @@ func runDeploy(args []string) { } func deployApp(host, domain, name, binaryPath string, portOverride int, envVars []string, envFile, args string, files []string) { - // Determine app name - if name == "" { - if binaryPath != "" { - name = filepath.Base(binaryPath) - } else { - // Try to find a binary in current directory - cwd, _ := os.Getwd() - name = filepath.Base(cwd) - } + // Require binary path + if binaryPath == "" { + fmt.Fprintf(os.Stderr, "Error: --binary is required\n") + os.Exit(1) } - // Find binary if not specified - if binaryPath == "" { - // Look for binary with same name as directory - if _, err := os.Stat(name); err == nil { - binaryPath = name - } else { - fmt.Fprintf(os.Stderr, "Error: --binary is required (could not find binary in current directory)\n") - os.Exit(1) - } + // Determine app name from binary if not specified + if name == "" { + name = filepath.Base(binaryPath) } // Verify binary exists diff --git a/cmd/deploy/main.go b/cmd/deploy/main.go index 1589af3..e86eff7 100644 --- a/cmd/deploy/main.go +++ b/cmd/deploy/main.go @@ -16,11 +16,9 @@ func main() { switch command { case "init": runInit(os.Args[2:]) - case "deploy": - runDeploy(os.Args[2:]) case "list": runList(os.Args[2:]) - case "remove": + case "rm", "remove": runRemove(os.Args[2:]) case "logs": runLogs(os.Args[2:]) @@ -35,9 +33,8 @@ func main() { case "help", "--help", "-h": printUsage() default: - fmt.Fprintf(os.Stderr, "Unknown command: %s\n\n", command) - printUsage() - os.Exit(1) + // Default action is deploy - pass all args including the first one + runDeploy(os.Args[1:]) } } @@ -45,13 +42,13 @@ func printUsage() { usage := `deploy - Deploy Go apps and static sites to a VPS with automatic HTTPS USAGE: - deploy [flags] + deploy [flags] Deploy an app or static site + deploy [flags] Run a subcommand COMMANDS: init Initialize a fresh VPS (one-time setup) - deploy Deploy a Go app or static site list List all deployed apps and sites - remove Remove a deployment + rm Remove a deployment logs View logs for a deployment status Check status of a deployment restart Restart a deployment @@ -59,24 +56,23 @@ COMMANDS: webui Launch web UI to manage deployments FLAGS: - Run 'deploy -h' for command-specific flags + Run 'deploy -h' or 'deploy -h' for flags EXAMPLES: - # Initialize VPS + # Initialize VPS (sets it as default host) deploy init --host user@vps-ip # Deploy Go app - deploy deploy --host user@vps-ip --binary ./myapp --domain api.example.com + deploy --binary ./myapp --domain api.example.com # Deploy static site - deploy deploy --host user@vps-ip --static --dir ./dist --domain example.com + deploy --static --dir ./dist --domain example.com # List deployments - deploy list --host user@vps-ip + deploy list -CONFIG FILE: - Create ~/.config/deploy/config to set default host: - host: user@your-vps-ip + # View logs + deploy logs myapp ` fmt.Fprint(os.Stderr, usage) } -- cgit v1.2.3