Support functions for navigating Google3
I had `tbz`, which toggles between a project directory and it's associated blaze-bin. I added three functions which support navigating to blaze-bin, blaze-genfiles, and to the project root.
This commit is contained in:
parent
01b985fdd9
commit
a7c72adb2e
1 changed files with 23 additions and 0 deletions
|
@ -42,6 +42,29 @@ fv() {
|
|||
[[ -n "$file" ]] && vim "$file"
|
||||
}
|
||||
|
||||
project_root() {
|
||||
# Changes to the directory of the project root.
|
||||
if [[ "$(pwd)" =~ '(.*)/blaze-bin(.*)' ]]; then
|
||||
cd "${match[1]}${match[2]}"
|
||||
elif [[ "$(pwd)" =~ '(.*)/blaze-genfiles(.*)' ]]; then
|
||||
cd "${match[1]}${match[2]}"
|
||||
fi
|
||||
}
|
||||
|
||||
blaze_bin() {
|
||||
# Changes to the blaze-bin directory.
|
||||
# Depends:
|
||||
# - project_root
|
||||
project_root && cd "${PWD/\/google3//google3/blaze-bin}"
|
||||
}
|
||||
|
||||
blaze_genfiles() {
|
||||
# Changes to the blaze-genfiles directory.
|
||||
# Depends:
|
||||
# - project_root
|
||||
project_root && cd "${PWD/\/google3//google3/blaze-genfiles}"
|
||||
}
|
||||
|
||||
tbz() {
|
||||
# Toggle between blaze-bin and your source.
|
||||
# Useful if you like to cd into the dir where your source lives.
|
||||
|
|
Loading…
Reference in a new issue