Skip to content

Commit a3bd86f

Browse files
committed
handle branches containing / and fix usage
1 parent 8f59f04 commit a3bd86f

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Extra dependencies:
1616

1717
```
1818
Usage:
19-
work switch interactive switcher, prints tree path
19+
work interactive switcher, prints tree path
2020
work i, init prepare cwd for work
2121
work ls, list list work trees
2222
work b, branch [name] switch current work tree to branch

work

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function cwd_is_git_repo() {
2727
function usage() {
2828
cat << HEREDOC
2929
Usage:
30-
$PROGRAM_NAME switch interactive switcher, prints tree path
30+
$PROGRAM_NAME interactive switcher, prints tree path
3131
$PROGRAM_NAME i, init prepare cwd for work
3232
$PROGRAM_NAME ls, list list work trees
3333
$PROGRAM_NAME b, branch [name] switch current work tree to branch
@@ -66,13 +66,13 @@ function handle_list() {
6666
}
6767

6868
function handle_switch() {
69-
SELECTION=$(git worktree list | sed -r 's/^(.*\/([^[:space:]]*))/\1 \2/g' | fzf --with-nth=2,4 --height 10 --border --prompt "tree: ")
69+
SELECTION=$(git worktree list | sed -r 's/^(.*\/([^[:space:]]* ))/\1 \2/g' | fzf --with-nth=2,4 --height 10 --border --prompt "tree: ")
7070
if [ -z "$SELECTION" ]; then
7171
exit 0
7272
fi
7373
DIR=$(cut -d" " -f1 <<< "$SELECTION")
7474
if [[ -f "$CWD_PARENT/hook.sh" ]]; then
75-
exec "$CWD_PARENT/hook.sh"
75+
exec "$CWD_PARENT/hook.sh $DIR"
7676
fi
7777
echo "-> $DIR"
7878
}

0 commit comments

Comments
 (0)