Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ before:
builds:
- env:
- CGO_ENABLED=0
ldflags:
- -s -w -X main.version={{.Version}}
goos:
- linux
- windows
Expand Down
12 changes: 10 additions & 2 deletions cmd/opencode-worktree/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ import (
"github.com/danhenton/opencode-worktree/internal/worktree"
)

// version is set at build time via ldflags. Defaults to "dev" for local builds.
var version = "dev"

func main() {
if len(os.Args) < 2 {
printUsage()
Expand All @@ -32,6 +35,8 @@ func main() {
runCompletions(os.Args[2:])
case "-h", "--help", "help":
printUsage()
case "version", "--version":
fmt.Printf("opencode-worktree %s\n", version)
default:
fmt.Fprintf(os.Stderr, "❌ Unknown command: %s\n\n", os.Args[1])
printUsage()
Expand All @@ -40,7 +45,9 @@ func main() {
}

func printUsage() {
fmt.Print(`Usage: opencode-worktree <command> [options]
fmt.Printf(`opencode-worktree %s

Usage: opencode-worktree <command> [options]

Commands:
task <name> [message] Create agent worktree and launch opencode
Expand All @@ -60,10 +67,11 @@ Merge Options:

General:
-h, --help Show this help message
version, --version Show version

Alias:
The installer adds 'ocwt' as a shell alias for opencode-worktree.
`)
`, version)
}

func runTask(args []string) {
Expand Down