-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathfunctions.sh
32 lines (24 loc) · 910 Bytes
/
functions.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
function _develo_root_dir {
local current_dir=$(pwd -P |sed 's/ /\\ /g' 2>/dev/null || command pwd);
while [ ! -e "$current_dir/.develo" ]; do
current_dir=${current_dir%/*}
if [ "$current_dir" = "" ]; then break; fi
done
(builtin cd "$current_dir" && echo "`pwd -P`")
}
is_function() { [[ "$(declare -Ff "$1")" ]]; }
# Predefine cd for autoload
function cd {
local directory="$1";
# The case is:
# When you are using cd without any arugments ... have to go to the home dir
# And the or statement is when you are changing to dir with space
# like this one "Some\ Directory"
[[ $# -eq 0 ]] && builtin cd || builtin cd "$directory";
#RVM hooks pactch
[[ -n \"\${rvm_current_rvmrc:-""}\" && \"\$*\" == \".\" ]] && rvm_current_rvmrc=\"\" || true
is_function __rvm_cd_functions_set && __rvm_cd_functions_set
if [ -d "$DEVELO_DIR" ]; then
_develo_detected;
fi
}