mirror of
https://github.com/harivansh-afk/nix.git
synced 2026-04-16 08:02:23 +00:00
Add netty worktree helpers
Add netty-specific worktree helper commands and a zsh wrapper that creates sibling worktrees and cds into them. Also split script packaging so Darwin keeps the existing wt integration while netty gets git-worktree-based helpers. Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
parent
2a79a099c1
commit
8ad1784a82
7 changed files with 172 additions and 74 deletions
26
scripts/wt-path.sh
Normal file
26
scripts/wt-path.sh
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
if [[ $# -ne 1 ]]; then
|
||||
printf 'usage: wt-path <worktree-name>\n' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
repo_root=$(git rev-parse --show-toplevel 2>/dev/null) || {
|
||||
printf 'wt-path: not inside a git repository\n' >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
worktree_name=$1
|
||||
clean_name=$(printf '%s' "$worktree_name" | sed -E 's#[^[:alnum:]._-]+#-#g; s#-+#-#g; s#(^[.-]+|[.-]+$)##g')
|
||||
|
||||
if [[ -z "$clean_name" ]]; then
|
||||
printf 'wt-path: %s does not produce a usable path name\n' "$worktree_name" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
repo_parent=$(dirname "$repo_root")
|
||||
repo_name=$(basename "$repo_root")
|
||||
|
||||
printf '%s/%s-%s\n' "$repo_parent" "$repo_name" "$clean_name"
|
||||
Loading…
Add table
Add a link
Reference in a new issue