Skip to content

Commit

Permalink
Edit instructions to auto switch via zsh
Browse files Browse the repository at this point in the history
  • Loading branch information
warrensbox committed Apr 8, 2019
1 parent b55f1e6 commit 1fcea03
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions README.md
Expand Up @@ -82,29 +82,27 @@ alias cd='cdtfswitch'

Add the following to the end of your `~/.zshrc` file:

*With add-zsh-hook enabled*
```
load-tfswitch() {
local tfswitchrc_path=".tfswitchrc"
if [ -f "$tfswitchrc_path" ]; then
cd(){
builtin cd "$@";
cdir=$PWD;
if [ -f "$cdir/.tfswitchrc" ]; then
tfswitch
fi
}
add-zsh-hook chpwd load-tfswitch
load-tfswitch
```

*Without add-zsh-hook enabled (similiar to bashrc setup)*
*Without add-zsh-hook enabled (newer version)*
```
cdtfswitch(){
builtin cd "$@";
cdir=$PWD;
if [ -f "$cdir/.tfswitchrc" ]; then
load-tfswitch() {
local tfswitchrc_path=".tfswitchrc"
if [ -f "$tfswitchrc_path" ]; then
tfswitch
fi
}
alias cd='cdtfswitch'
add-zsh-hook chpwd load-tfswitch
load-tfswitch
```

## Additional Info
Expand Down

0 comments on commit 1fcea03

Please sign in to comment.