File tree Expand file tree Collapse file tree 2 files changed +37
-1
lines changed
Expand file tree Collapse file tree 2 files changed +37
-1
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,21 @@ Copy the executable to any directory in your `$PATH`
1818$ sudo cp wt /usr/local/bin
1919```
2020
21+ ### Tab Completion
22+ :warning : Only ** bash** completion is available for now.
23+
24+ ``` bash
25+ sudo cp wt_completion.bash /etc/bash_completion.d
26+ ```
27+
28+ ``` bash
29+ wt < TAB> < TAB>
30+
31+ # OR
32+
33+ wt < completion-characters> < TAB>
34+ ```
35+
2136## Usage
2237Switch between worktrees.
2338You can do a text search to change to the worktree directory.
@@ -48,4 +63,4 @@ Update to the latest release
4863
4964``` bash
5065$ wt update
51- ```
66+ ```
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ _wt () {
4+ local cur opts
5+ COMPREPLY=()
6+ cur=" ${COMP_WORDS[COMP_CWORD]} "
7+ list=" $( wt list | awk ' { print $1; }' | tr " \n" " " ) "
8+ opts=" "
9+
10+ for item in $list
11+ do
12+ opts+=" $( basename " $item " ) "
13+ done
14+
15+ if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
16+ local cur=${COMP_WORDS[COMP_CWORD]}
17+ COMPREPLY=( $( compgen -W " ${opts} " -- " $cur " ) )
18+ fi
19+ }
20+
21+ complete -F _wt wt
You can’t perform that action at this time.
0 commit comments