-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from DanCardin/dc/shell
Add support for more shell features
- Loading branch information
Showing
18 changed files
with
330 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
function {0} {{ | ||
eval "$(command {1} --shell bash "$@")" | ||
}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# create a PROPMT_COMMAND equivalent to store chpwd functions | ||
typeset -g CHPWD_COMMAND="" | ||
|
||
_chpwd_hook() {{ | ||
shopt -s nullglob | ||
|
||
local f | ||
|
||
# run commands in CHPWD_COMMAND variable on dir change | ||
if [[ "$PREVPWD" != "$PWD" ]]; then | ||
local IFS=$';' | ||
for f in $CHPWD_COMMAND; do | ||
"$f" | ||
done | ||
unset IFS | ||
fi | ||
|
||
# refresh last working dir record | ||
export PREVPWD="$PWD" | ||
}} | ||
|
||
# add `;` after _chpwd_hook if PROMPT_COMMAND is not empty | ||
PROMPT_COMMAND="_chpwd_hook${{PROMPT_COMMAND:+;$PROMPT_COMMAND}}" | ||
|
||
_{0}_autoload() {{ | ||
{0} --autoload | ||
}} | ||
|
||
# append the command into CHPWD_COMMAND | ||
CHPWD_COMMAND="${{CHPWD_COMMAND:+$CHPWD_COMMAND;}}_{0}_autoload" |
Oops, something went wrong.