forked from davidde/git
-
Notifications
You must be signed in to change notification settings - Fork 1
/
platform.plugin.zsh
50 lines (39 loc) · 1.7 KB
/
platform.plugin.zsh
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
41
42
43
44
45
46
47
48
49
50
# Aliases
#############
alias pf='platform'
alias pfalias='platform_list_aliases'
alias pfala='platform activity:list --all'
alias pfal='platform activity:log'
alias pfdbd='platform db:dump --gzip'
alias pfea='platform environment:activate'
alias pfed='platform environment:delete'
alias pfd='platform environment:drush'
alias pfel='platform environment:list'
alias pfl='platform environment:logs'
alias pfer='platform environment:redeploy'
alias pfssh='platform environment:ssh'
# Functions
################
# List all git aliases from the README:
function platform_list_aliases() {
filename=~/.oh-my-zsh/custom/plugins/platform/README.md
from=$(grep -Fno '| **pf** ' ${filename} | cut -f1 -d:)
stop=$(grep -no ' ' ${filename} | cut -f1 -d:)
to=$((stop - 2))
echo '_____________________________________________________________________________
| | |
| Alias | Command |
|___________|_______________________________________________________________|
| | |'
sed -n "${from},${to}p;${stop}q" ${filename} | # Take out table
tr -d '*\\' | # Remove **bold** and \ escapes
sed 's/.$//' | # Remove last '|' because its no longer lining up
while read -r line ; do
echo "${(r:76:)line}" # Pad spaces to 76 chars
done |
sed 's/$/|/' # Re-append final '|'
echo '|___________|_______________________________________________________________|
Notes:
- If you want to see all alias implementations, run `alias`.
- If you want to see a specific implementation, run `which <alias/function>`.'
}