Populate repo
This commit is contained in:
22
zsh/g3path.zsh
Normal file
22
zsh/g3path.zsh
Normal file
@ -0,0 +1,22 @@
|
||||
g3path::hook () {
|
||||
if [[ $PWD =~ (^.*/([^/]+)/google3)($|/.*) ]]; then
|
||||
export GOOGLE3_ROOT="${match[1]}"
|
||||
export GOOGLE3_CLIENT="${match[2]}"
|
||||
export GOOGLE3_PATH="${match[3]:-/}"
|
||||
else
|
||||
unset GOOGLE3_ROOT GOOGLE3_CLIENT GOOGLE3_PATH
|
||||
fi
|
||||
}
|
||||
g3path::hook
|
||||
|
||||
autoload -Uz add-zsh-hook
|
||||
add-zsh-hook chpwd g3path::hook
|
||||
|
||||
g3path::zle::accept-line () {
|
||||
if [[ -n $GOOGLE3_ROOT && ! $BUFFER =~ \\s*(blaze|g4|p4|g4d|add_dep|buildozer|build_cleaner|debug_android_lint|rabbit|hb) ]]; then
|
||||
BUFFER=${BUFFER// \/\// $GOOGLE3_ROOT\/}
|
||||
fi
|
||||
zle .accept-line
|
||||
}
|
||||
|
||||
zle -N accept-line g3path::zle::accept-line
|
Reference in New Issue
Block a user