darkrc/bin/cd-improved

21 lines
290 B
Text
Raw Permalink Normal View History

2020-05-15 09:36:09 +00:00
#!/bin/sh
root="$(git rev-parse --show-toplevel 2>/dev/null)"
if [ -z "$root" ]
then
builtin cd "$@"
2020-05-15 09:36:09 +00:00
else
if [ -z "$1" ]
then
builtin cd "$root"
2020-05-15 09:36:09 +00:00
else
if [ $(echo "$1" | grep '^/') ]
then builtin cd "$root"$@
else builtin cd "$@"
2020-05-15 09:36:09 +00:00
fi
fi
fi
source smartprompt