-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.bash_xp
127 lines (104 loc) · 2.98 KB
/
.bash_xp
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
XP_TOOLS_DIR="~/tools/Magento-2-Bash-Localhost-Installation-Script"
function phpswitch() {
bash "$XP_TOOLS_DIR/phpswitch.sh" $1
}
function create_website() {
bash "$XP_TOOLS_DIR/install.sh" $1 $2 $3 $4
}
function create_pr_website() {
bash "$XP_TOOLS_DIR/install_pr.sh" $1 $2 $3 $4
}
function add_module() {
bash "$XP_TOOLS_DIR/add_module.sh" $1 $2 $3
}
function update_modules() {
bash "$XP_TOOLS_DIR/update_modules.sh"
}
function code_quality() {
bash "$XP_TOOLS_DIR/code_quality.sh" $1 $2 $3
}
function import_website() {
bash "$XP_TOOLS_DIR/import.sh" $1
}
function update_website() {
bash "$XP_TOOLS_DIR/update.sh" $1
}
source "$XP_TOOLS_DIR/environment_tools.sh"
_site ()
{
local cur=${COMP_WORDS[COMP_CWORD]};
COMPREPLY=($(compgen -W "$(ls ~/domains)" -- $cur))
}
site ()
{
if [ $# -eq 0 ]; then
DOMAIN=`pwd | cut --delimiter="/" -f 5`;
else
DOMAIN="$@";
fi;
if [ -d ~/domains/$DOMAIN ]; then
cd ~/domains/$DOMAIN;
else
echo "Given website does not exists";
fi
}
complete -F _site site
bind '"\e[A": history-search-backward'
bind '"\e[B": history-search-forward'
# Magerun aliasses
alias m='magerun'
alias m2='magerun2'
# PHP aliasses
alias php7='php7.0'
alias composer7='php7 /usr/bin/composer'
alias php71='php7.1'
alias composer71='php71 /usr/bin/composer'
# PhpStorm aliasses
alias p='phpstorm'
# PHPX - Xdebug
alias phpx='XDEBUG_CONFIG="idekey=PHPSTORM" php -dxdebug.remote_enable=on -f'
alias xphp='XDEBUG_CONFIG="idekey=PHPSTORM" php -dxdebug.remote_enable=on -f'
alias phpx7='XDEBUG_CONFIG="idekey=PHPSTORM" php7.0 -dxdebug.remote_enable=on -f'
alias xphp7='XDEBUG_CONFIG="idekey=PHPSTORM" php7.0 -dxdebug.remote_enable=on -f'
# Git aliasses
alias gs='git status'
alias gc='git commit'
alias ga='git add'
alias gb='git branch'
alias gl='git log'
alias gco='git checkout'
alias gcom='git checkout master'
alias gam='git commit --amend --no-edit'
alias gp='git push'
alias gpom='git push origin master'
alias gm='git merge'
alias gd='git diff'
# Composer Lib Development alias
alias cld='composer_lib_development'
# Update Developer Programs Linux
alias update_postman='sudo rm -rf /opt/Postman/; wget https://dl.pstmn.io/download/latest/linux64 -O postman.tar.gz; sudo tar -xzf postman.tar.gz -C /opt; rm postman.tar.gz'
# Environment tools
alias emnt=mount_site
alias eumnt=umount_site
alias edbg=debug_site
# Custom prompt
function parse_git_branch() { # Git Branch
BRANCH=`git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'`
if [ ! "${BRANCH}" == "" ]
then
echo "[${BRANCH}]"
else
echo ""
fi
}
function parse_git_tag() { # Git Tag
TAG=`git describe --abbrev=0 --tags 2> /dev/null`
if [ ! "${TAG}" == "" ]
then
echo "[${TAG}]"
else
echo ""
fi
}
# PS1 Line
PS1="\[\e[00;33m\]\u\[\e[0m\]\[\e[00;37m\]@\h:\[\e[0m\]\[\e[0;31m\]\`parse_git_branch\`\[\e[m\]\[\e[0m\]\[\e[0;38m\]\`parse_git_tag\`\[\e[m\]\[\e[00;36m\][\w]\[\e[0m\]\[\e[00;32m\]\nbash> \[\e[0m\]"