@jswork/ushell-module-git 1.0.70 → 1.0.71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/modules/16-wt.sh +2 -40
- package/package.json +1 -1
package/modules/16-wt.sh
CHANGED
|
@@ -1,43 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
|
|
3
|
-
#
|
|
4
|
-
# Shell function for true directory switching with wt binary
|
|
3
|
+
# wtt - Git Worktree 快速切换工具
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
if command -v wt >/dev/null 2>&1; then
|
|
8
|
-
|
|
9
|
-
# Store the actual wt binary path to avoid recursion
|
|
10
|
-
WT_BIN=$(command -v wt)
|
|
11
|
-
|
|
12
|
-
# wt function for directory switching
|
|
13
|
-
wt() {
|
|
14
|
-
case "$1" in
|
|
15
|
-
switch|co)
|
|
16
|
-
shift
|
|
17
|
-
local path
|
|
18
|
-
path=$($WT_BIN switch "$@" 2>/dev/null)
|
|
19
|
-
|
|
20
|
-
# Check if we got a valid path
|
|
21
|
-
if [[ "$path" = /* ]] && [[ -d "$path" ]]; then
|
|
22
|
-
cd "$path" || return 1
|
|
23
|
-
echo "✅ Switched to: $path"
|
|
24
|
-
else
|
|
25
|
-
# Show errors from the binary
|
|
26
|
-
$WT_BIN switch "$@"
|
|
27
|
-
fi
|
|
28
|
-
;;
|
|
29
|
-
*)
|
|
30
|
-
# Pass all other commands to wt binary
|
|
31
|
-
"$WT_BIN" "$@"
|
|
32
|
-
;;
|
|
33
|
-
esac
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
else
|
|
37
|
-
# wt binary not found - show installation message once
|
|
38
|
-
if [[ -z "$WT_SHOWN_MISSING" ]]; then
|
|
39
|
-
echo "⚠️ wt CLI not found in PATH"
|
|
40
|
-
echo "Install: go build -o wt main.go && sudo mv wt /usr/local/bin/wt"
|
|
41
|
-
export WT_SHOWN_MISSING=1
|
|
42
|
-
fi
|
|
43
|
-
fi
|
|
5
|
+
alias wtt="wt co && source ~/.config/wt/boot.sh"
|