Skip to content

Commit

Permalink
Add es hook
Browse files Browse the repository at this point in the history
  • Loading branch information
avindra committed Jan 28, 2021
1 parent fe05ae3 commit d34855b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
2 changes: 2 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ func main() {
switch args[1] {
case "fish":
dirp.PrintFishHook()
case "es":
dirp.PrintEsHook()
case "rc":
dirp.PrintRcHook()
default:
Expand Down
20 changes: 20 additions & 0 deletions src/hook.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,23 @@ func PrintRcHook() {

fmt.Println(strings.ReplaceAll(src, "\t", " "))
}

// PrintEsHook emits code for es, a shell based on rc
func PrintEsHook() {
fmt.Println(`fn dir {
stdout=` + "`" + `{dirp $*};
if {~ $bqstatus 2 } {
$EDITOR $stdout;
return $status;
};
if {~ "x$stdout" "x" } {
echo -n "How are we doing @";
uptime;
return $status;
};
echo Switching to $stdout;
cd $stdout
}`)
}

0 comments on commit d34855b

Please sign in to comment.