Add zsh function to go to a project's root dir
This commit is contained in:
parent
6d7bd71f13
commit
ca31d59176
1 changed files with 13 additions and 0 deletions
13
zsh/.zsh/functions/cdp
Normal file
13
zsh/.zsh/functions/cdp
Normal file
|
@ -0,0 +1,13 @@
|
|||
# -*- mode: sh; -*-
|
||||
local _pwd=$(pwd)
|
||||
|
||||
while; do
|
||||
cd ..
|
||||
[[ ! -d '.git' && "$(pwd)" != "/" ]] || break
|
||||
done
|
||||
|
||||
if [[ "$(pwd)" == "/" ]]; then
|
||||
cd $_pwd
|
||||
echo 'Project root not found' >&2
|
||||
return 1
|
||||
fi
|
Loading…
Reference in a new issue