-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
104 lines (89 loc) · 2.61 KB
/
Copy pathmain.go
File metadata and controls
104 lines (89 loc) · 2.61 KB
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
package main
import (
"fmt"
"os"
"github.com/WillCMcC/ws/cmd"
)
var version = "dev"
func main() {
if len(os.Args) < 2 {
printUsage()
os.Exit(0)
}
command := os.Args[1]
args := os.Args[2:]
var exitCode int
switch command {
case "new":
exitCode = cmd.NewCmd(args)
case "ez":
exitCode = cmd.EzCmd(args)
case "list", "ls":
exitCode = cmd.ListCmd(args)
case "go":
exitCode = cmd.GoCmd(args)
case "home":
exitCode = cmd.HomeCmd(args)
case "done", "rm", "remove":
exitCode = cmd.DoneCmd(args)
case "fold":
exitCode = cmd.FoldCmd(args)
case "auto-rebase":
exitCode = cmd.AutoRebaseCmd(args)
case "status", "st":
exitCode = cmd.StatusCmd(args)
case "prune":
exitCode = cmd.PruneCmd(args)
case "init":
exitCode = cmd.InitCmd(args)
case "config":
exitCode = cmd.ConfigCmd(args)
case "agent-cmd":
// Internal command for shell integration to get agent command
fmt.Print(cmd.GetAgentCmd())
exitCode = 0
case "version", "--version", "-v":
fmt.Printf("ws version %s\n", version)
exitCode = 0
case "help", "--help", "-h":
printUsage()
exitCode = 0
default:
fmt.Fprintf(os.Stderr, "ws: unknown command '%s'\n", command)
fmt.Fprintf(os.Stderr, " Run 'ws help' for usage.\n")
exitCode = 1
}
os.Exit(exitCode)
}
func printUsage() {
fmt.Println(`ws - Workspace manager for parallel agent development
Usage: ws <command> [arguments]
Commands:
new <name> Create a new workspace and navigate to it
ez <name> Create workspace, navigate, and start agent
list List all workspaces
go <name> Navigate to a workspace
home Navigate to main repository
done <name> Remove a workspace
fold [name] Rebase and merge workspace into default branch
auto-rebase Start agent to help resolve rebase conflicts
status Show detailed status of all workspaces
prune Clean up stale worktrees
init Set up shell integration
config Manage configuration
Aliases:
ls Alias for 'list'
rm, remove Alias for 'done'
st Alias for 'status'
Examples:
ws new auth-feature Create workspace and cd into it
ws ez auth-feature Create, cd, and start agent
ws list List all workspaces
ws go auth-feature Navigate to workspace
ws home Navigate back to main repo
ws fold Rebase and merge current workspace
ws done auth-feature Remove workspace when done
Environment:
WS_AGENT_CMD Agent command for 'ws ez' (default: claude)
Run 'ws <command> --help' for more information on a command.`)
}