-
Notifications
You must be signed in to change notification settings - Fork 121
/
shell-config-bash-direct.tmpl.rc
35 lines (32 loc) · 1.1 KB
/
shell-config-bash-direct.tmpl.rc
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
# {{ application.name }} shell configuration for Bash and ZSH.
##
## Keys inside double curly brackets will be replaced by their config value
## during installation. Lines beginning with ## will be removed.
# Enable auto-completion.
if [ -f "$HOME/{{ application.user_config_dir }}/autocompletion.sh" ]; then
. "$HOME/{{ application.user_config_dir }}/autocompletion.sh" 2>/dev/null
fi
# Alias: make the CLI available via "p", if a command with that name doesn't
# already exist.
if ! command -v p >/dev/null; then
alias p=platform
fi
# Alias: run Drush commands on the local environment, from any directory.
platform_local_drush() {
local GROUP
GROUP="$(platform drush-aliases --no --pipe 2>/dev/null)"
CODE=$?
if [ "$CODE" = 2 ]; then
echo "$0"': This can only be run from inside a project directory' >&2
return "$CODE"
elif [ ! "$CODE" = 0 ]; then
echo "$0"': Drush alias group not found' >&2
return "$CODE"
fi
if [ -z "$1" ]; then
drush @"$GROUP"._local status
else
drush @"$GROUP"._local "$@"
fi
}
alias pldr=platform_local_drush