mirror of
https://github.com/Llewellynvdm/zoxide.git
synced 2024-12-29 12:32:40 +00:00
Add 'z -' capability to bash and zsh
This commit is contained in:
parent
34ab8f3f8b
commit
15b30206df
24
src/main.rs
24
src/main.rs
@ -157,18 +157,20 @@ case "$PROMPT_COMMAND" in
|
||||
esac
|
||||
|
||||
z() {
|
||||
if [ $# -ne 0 ]; then
|
||||
if [ "$#" -eq 0 ]; then
|
||||
cd "$HOME"
|
||||
elif [ "$#" -eq 1 ] && [ "$1" = "-" ]; then
|
||||
cd "-"
|
||||
else
|
||||
_Z_RESULT=$(zoxide query "$@")
|
||||
case $_Z_RESULT in
|
||||
case "$_Z_RESULT" in
|
||||
"query: "*)
|
||||
cd "${_Z_RESULT:7}"
|
||||
;;
|
||||
*)
|
||||
echo -n "${_Z_RESULT}"
|
||||
echo -n "$_Z_RESULT"
|
||||
;;
|
||||
esac
|
||||
else
|
||||
cd "${HOME}"
|
||||
fi
|
||||
}
|
||||
"#;
|
||||
@ -220,18 +222,20 @@ _zoxide_precmd() {
|
||||
}
|
||||
|
||||
z() {
|
||||
if [ $# -ne 0 ]; then
|
||||
if [ "$#" -eq 0 ]; then
|
||||
cd "$HOME"
|
||||
elif [ "$#" -eq 1 ] && [ "$1" = "-" ]; then
|
||||
cd "-"
|
||||
else
|
||||
_Z_RESULT=$(zoxide query "$@")
|
||||
case $_Z_RESULT in
|
||||
case "$_Z_RESULT" in
|
||||
"query: "*)
|
||||
cd "${_Z_RESULT:7}"
|
||||
;;
|
||||
*)
|
||||
echo -n "${_Z_RESULT}"
|
||||
echo -n "$_Z_RESULT"
|
||||
;;
|
||||
esac
|
||||
else
|
||||
cd "${HOME}"
|
||||
fi
|
||||
}
|
||||
"#;
|
||||
|
Loading…
Reference in New Issue
Block a user