summaryrefslogtreecommitdiffstats
path: root/cmd/deploy/main.go
blob: e86eff790ab03ad7eed216f2d312b484575a6ebf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
package main

import (
	"fmt"
	"os"
)

func main() {
	if len(os.Args) < 2 {
		printUsage()
		os.Exit(1)
	}

	command := os.Args[1]

	switch command {
	case "init":
		runInit(os.Args[2:])
	case "list":
		runList(os.Args[2:])
	case "rm", "remove":
		runRemove(os.Args[2:])
	case "logs":
		runLogs(os.Args[2:])
	case "status":
		runStatus(os.Args[2:])
	case "restart":
		runRestart(os.Args[2:])
	case "env":
		runEnv(os.Args[2:])
	case "webui":
		runWebUI(os.Args[2:])
	case "help", "--help", "-h":
		printUsage()
	default:
		// Default action is deploy - pass all args including the first one
		runDeploy(os.Args[1:])
	}
}

func printUsage() {
	usage := `deploy - Deploy Go apps and static sites to a VPS with automatic HTTPS

USAGE:
  deploy [flags]              Deploy an app or static site
  deploy <command> [flags]    Run a subcommand

COMMANDS:
  init      Initialize a fresh VPS (one-time setup)
  list      List all deployed apps and sites
  rm        Remove a deployment
  logs      View logs for a deployment
  status    Check status of a deployment
  restart   Restart a deployment
  env       Manage environment variables
  webui     Launch web UI to manage deployments

FLAGS:
  Run 'deploy -h' or 'deploy <command> -h' for flags

EXAMPLES:
  # Initialize VPS (sets it as default host)
  deploy init --host user@vps-ip

  # Deploy Go app
  deploy --binary ./myapp --domain api.example.com

  # Deploy static site
  deploy --static --dir ./dist --domain example.com

  # List deployments
  deploy list

  # View logs
  deploy logs myapp
`
	fmt.Fprint(os.Stderr, usage)
}