forked from platformsh/legacy-cli
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathshell-config.rc
30 lines (28 loc) · 921 Bytes
/
shell-config.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
#!/usr/bin/env bash
# Platform.sh CLI shell configuration.
# Enable auto-completion.
if HOOK=$(platform _completion -g -p platform 2>/dev/null); then
# Try two commands.
# See https://github.com/stecman/symfony-console-completion/issues/12
echo "$HOOK" | source /dev/stdin
source <(echo "$HOOK") 2>/dev/null
fi
# Run Drush commands on the local environment, from any working directory.
function 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