-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbp
40 lines (35 loc) · 999 Bytes
/
bp
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
33
34
35
36
37
38
39
40
#!/bin/sh
# Creates an alias command for running a Boilerplate project bin script from
# any directory. Examples:
#
# bp push {{ instance }}
#
# or
#
# bp ssh {{ instance }}
#
# or
#
# bp backup {{ instance }}
#
# Set up:
#
# 1. Change "bp" and BP below to your project's shorthand (so it doesn't
# conflict with other projects). The exported variables (BP), the alias
# name (bp), the alias function reference (_bp), and the function name (_bp)
# 2. Run ". bin/bp" to add the alias and try it out
# 3. Add ". ~/path/to/project/bin/bp" to your bash profile to have it added on terminal startup
export BP_BIN=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
# export BP_BIN=$( cd "$(dirname "${(%):-%N}")" ; pwd -P ) # zsh compatible
export BP=$(dirname "$BP_BIN")
_bp() {
if [[ "$1" == "theme" ]]; then
source $BP/config/bin.cfg
cd "${BP}/${WP}wp-content/themes/${THEME}"
elif [[ "$1" == "" ]]; then
cd $BP;
else
(cd $BP ; sh bin/$1 "${@:2}")
fi
}
alias bp="_bp"