@jhorst11/wt 2.0.1 → 2.1.0

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/shell/wt.sh DELETED
@@ -1,66 +0,0 @@
1
- #!/usr/bin/env bash
2
- # Shell wrapper for wt-cli to enable directory changing
3
- # Add this to your .bashrc or .zshrc:
4
- # source /path/to/wt/shell/wt.sh
5
-
6
- # Find the wt binary - works whether installed globally or locally
7
- _wt_find_bin() {
8
- if command -v wt &>/dev/null; then
9
- echo "wt"
10
- elif [[ -f "$HOME/.npm-global/bin/wt" ]]; then
11
- echo "$HOME/.npm-global/bin/wt"
12
- elif [[ -f "$(npm root -g 2>/dev/null)/wt-cli/bin/wt.js" ]]; then
13
- echo "node $(npm root -g)/wt-cli/bin/wt.js"
14
- else
15
- echo "wt"
16
- fi
17
- }
18
-
19
- wt() {
20
- local wt_bin=$(_wt_find_bin)
21
- local wt_cd_file="/tmp/wt_cd_$$"
22
-
23
- # Clean up any old cd file
24
- rm -f "$wt_cd_file"
25
-
26
- # Run wt with env vars so it knows we can handle cd
27
- WT_WRAPPER=1 WT_CD_FILE="$wt_cd_file" $wt_bin "$@"
28
- local exit_code=$?
29
-
30
- # Check if wt wrote a cd path
31
- if [[ -f "$wt_cd_file" ]]; then
32
- local dir=$(cat "$wt_cd_file")
33
- rm -f "$wt_cd_file"
34
- [[ -d "$dir" ]] && cd "$dir"
35
- fi
36
-
37
- return $exit_code
38
- }
39
-
40
- # Tab completion for bash
41
- if [[ -n "$BASH_VERSION" ]]; then
42
- _wt_completions() {
43
- local cur="${COMP_WORDS[COMP_CWORD]}"
44
- local commands="new list ls remove rm home go setup"
45
- COMPREPLY=($(compgen -W "$commands" -- "$cur"))
46
- }
47
- complete -F _wt_completions wt
48
- fi
49
-
50
- # Tab completion for zsh
51
- if [[ -n "$ZSH_VERSION" ]]; then
52
- _wt_completions() {
53
- local commands=(
54
- 'new:Create a new worktree'
55
- 'list:List all worktrees'
56
- 'ls:List all worktrees'
57
- 'remove:Remove a worktree'
58
- 'rm:Remove a worktree'
59
- 'home:Return to main repo'
60
- 'go:Jump to a worktree'
61
- 'setup:Configure shell integration'
62
- )
63
- _describe 'command' commands
64
- }
65
- compdef _wt_completions wt
66
- fi