Documentation
¶
Overview ¶
Package resolve provides target resolution for worktree commands.
Many wt commands operate on specific worktrees or repos. This package handles looking up targets and validating they still exist on disk.
Targeting Methods ¶
Commands support several targeting methods:
- -r/--repository: Target by repository name
- -l/--label: Target repos by label
- --branch: Target specific worktree by branch name
- -i/--interactive: Interactive selection
Usage Pattern ¶
Commands that use target resolution follow this pattern:
- Repo targeting: wt exec -r myrepo, wt cd -r myrepo
- Label targeting: wt exec -l backend, wt hook -l frontend
- Branch targeting: wt prune --branch feature, wt hook --branch feat
- Context-aware: wt note, wt pr create (default to current repo/branch)
The -r/--repository and -l/--label flags are used consistently across commands for repo-based targeting.
Index ¶
- type Target
- func ByRepoName(ctx context.Context, repoName, repoDir string) (*Target, error)
- func ByRepoOrPath(ctx context.Context, repository, worktreeDir, repoDir, workDir string) (*Target, error)
- func FromCurrentWorktree(ctx context.Context) (*Target, error)
- func FromCurrentWorktreeOrRepo(ctx context.Context) (*Target, error)
- func FromWorktreeOrRepoPath(ctx context.Context, path string) (*Target, error)
- func FromWorktreePath(ctx context.Context, path string) (*Target, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Target ¶
Target represents a resolved worktree target
func ByRepoName ¶ added in v0.7.0
ByRepoName resolves a target by repository name. Returns target with current branch of that repo.
func ByRepoOrPath ¶ added in v0.13.0
func ByRepoOrPath(ctx context.Context, repository, worktreeDir, repoDir, workDir string) (*Target, error)
ByRepoOrPath resolves target with 2 modes: 1. repository != "": by repository name (uses repoDir, falls back to worktreeDir) 2. repository == "": from current path (worktree or main repo)
func FromCurrentWorktree ¶ added in v0.7.0
FromCurrentWorktree resolves target from the current working directory. Returns error if not inside a git worktree.
func FromCurrentWorktreeOrRepo ¶ added in v0.7.0
FromCurrentWorktreeOrRepo resolves target from the current working directory. Works in both worktrees and main repos.
func FromWorktreeOrRepoPath ¶ added in v0.8.0
FromWorktreeOrRepoPath resolves target from the given path. Works in both worktrees and main repos.