Skip to content

Commit 62ad9ef

Browse files
committed
Breaking: shell hook defaults
Fish is not the default shell anymore. For traditional shells, users now need to call: ```sh eval "$(dirp hook)" ``` Fish users should use: ```fish dirp hook fish | source ``` Previously, users would call `dirp hook bash`. Now the shell hook is compatible with BusyBox and a few other variants, so the default has been changed.
1 parent 9c951f4 commit 62ad9ef

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

main.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ func main() {
2525
cfg := dirp.FindDirs(arg0)
2626
dirp.Selector(cfg)
2727
} else if arg0 == "hook" {
28-
if len(args) >= 2 && args[1] == "bash" {
29-
dirp.PrintBashHook()
28+
if len(args) >= 2 && args[1] == "fish" {
29+
dirp.PrintFishHook()
3030
} else {
31-
dirp.PrintHook() // fish
31+
dirp.PrintHook()
3232
}
3333
} else if arg0 == "cfg" {
3434
fmt.Print(dirp.GetConfigPath())

src/hook.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ package dirp
22

33
import "fmt"
44

5-
// PrintBashHook emits shell code for Bash, ZSH, sh, BusyBox, etc
6-
func PrintBashHook() {
5+
// PrintHook emits shell code for Bash, ZSH, sh, BusyBox, etc
6+
func PrintHook() {
77
// 1) Remove existing "dir" aliases, if any exit
88
// 2) Detect and prefer pushd over cd
99
// 3) Provide "dir" function
@@ -34,8 +34,8 @@ function dir() {
3434
export -f dir &> /dev/null`)
3535
}
3636

37-
// PrintHook emits shell code for Fish
38-
func PrintHook() {
37+
// PrintFishHook emits shell code for Fish
38+
func PrintFishHook() {
3939
fmt.Println(`function dir
4040
set stdout (dirp $argv)
4141
if [ $status = 2 ]

0 commit comments

Comments
 (0)