@jswork/ushell-module-git 1.0.65 → 1.0.67
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/.idea/modules.xml +8 -0
- package/.idea/ushell-module-git.iml +12 -0
- package/.idea/vcs.xml +6 -0
- package/index.sh +1 -0
- package/modules/16-wt.sh +52 -0
- package/package.json +1 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="ProjectModuleManager">
|
|
4
|
+
<modules>
|
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/ushell-module-git.iml" filepath="$PROJECT_DIR$/.idea/ushell-module-git.iml" />
|
|
6
|
+
</modules>
|
|
7
|
+
</component>
|
|
8
|
+
</project>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<module type="WEB_MODULE" version="4">
|
|
3
|
+
<component name="NewModuleRootManager">
|
|
4
|
+
<content url="file://$MODULE_DIR$">
|
|
5
|
+
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
|
|
6
|
+
<excludeFolder url="file://$MODULE_DIR$/temp" />
|
|
7
|
+
<excludeFolder url="file://$MODULE_DIR$/tmp" />
|
|
8
|
+
</content>
|
|
9
|
+
<orderEntry type="inheritedJdk" />
|
|
10
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
|
11
|
+
</component>
|
|
12
|
+
</module>
|
package/.idea/vcs.xml
ADDED
package/index.sh
CHANGED
package/modules/16-wt.sh
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
# wt CLI - Git Worktree Directory Switching
|
|
4
|
+
# https://github.com/yourusername/worktree-cli
|
|
5
|
+
|
|
6
|
+
# Check if wt binary exists
|
|
7
|
+
if command -v wt >/dev/null 2>&1; then
|
|
8
|
+
|
|
9
|
+
# Find the actual wt binary path
|
|
10
|
+
WT_BIN=$(command -v wt)
|
|
11
|
+
|
|
12
|
+
# 🚀 wt function for true directory switching
|
|
13
|
+
# This function overrides the wt binary to support real directory switching
|
|
14
|
+
wt() {
|
|
15
|
+
case "$1" in
|
|
16
|
+
switch|co)
|
|
17
|
+
# Handle switch/co commands for true directory switching
|
|
18
|
+
shift
|
|
19
|
+
local wt_cli="$WT_BIN" # Use the actual binary path
|
|
20
|
+
|
|
21
|
+
# Get the path from wt switch command
|
|
22
|
+
local path
|
|
23
|
+
path=$($wt_cli switch "$@" 2>/dev/null)
|
|
24
|
+
|
|
25
|
+
# Check if we got a valid path (absolute path starts with /)
|
|
26
|
+
if [[ "$path" = /* ]] && [[ -d "$path" ]]; then
|
|
27
|
+
cd "$path" || return 1
|
|
28
|
+
echo "✅ Switched to: $path"
|
|
29
|
+
else
|
|
30
|
+
# Let the original command handle errors and display
|
|
31
|
+
$wt_cli switch "$@"
|
|
32
|
+
fi
|
|
33
|
+
;;
|
|
34
|
+
*)
|
|
35
|
+
# Pass all other commands to wt binary (use full path to avoid recursion)
|
|
36
|
+
"$WT_BIN" "$@"
|
|
37
|
+
;;
|
|
38
|
+
esac
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
# Convenience alias
|
|
42
|
+
alias wtco='wt co' # Quick switch to worktree
|
|
43
|
+
alias wtl='wt switch --list' # List all worktrees
|
|
44
|
+
|
|
45
|
+
else
|
|
46
|
+
# wt binary not found - show installation message once
|
|
47
|
+
if [[ -z "$WT_SHOWN_MISSING" ]]; then
|
|
48
|
+
echo "⚠️ wt CLI not found in PATH"
|
|
49
|
+
echo "Install: go build -o wt main.go && sudo mv wt /usr/local/bin/wt"
|
|
50
|
+
export WT_SHOWN_MISSING=1
|
|
51
|
+
fi
|
|
52
|
+
fi
|