-
Notifications
You must be signed in to change notification settings - Fork 10
/
.functions
129 lines (106 loc) · 3.19 KB
/
.functions
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
128
129
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m'
function dockerize() {
CURRENT_DIR="$(pwd)/"
TEMPLATE_DIR="${HOME}/Code/template-boilerplate/"
cp -r "${TEMPLATE_DIR}docker" $CURRENT_DIR
cp -r "${TEMPLATE_DIR}deployments" $CURRENT_DIR
cp "${TEMPLATE_DIR}.dockerignore" $CURRENT_DIR
cp "${TEMPLATE_DIR}.gitlab-ci.template.yml" $CURRENT_DIR
cp "${TEMPLATE_DIR}Dockerfile" $CURRENT_DIR
cp "${TEMPLATE_DIR}docker-compose.yml" $CURRENT_DIR
cp "${TEMPLATE_DIR}docker-setup" $CURRENT_DIR
echo "${GREEN}SUCCESS: Folder '${CURRENT_DIR}' successfully dockerized${NC}"
php docker-setup $1 $2 $3
rm docker-setup
}
function artisan() {
php artisan "$@"
}
function vartisan() {
valet php artisan "$@"
}
function commit() {
commitMessage="$*"
git add .
if [ "$commitMessage" = "" ]; then
aicommits
return
fi
eval "git commit -a -m '${commitMessage}'"
}
function composer() {
/opt/homebrew/bin/php -d memory_limit=-1 /opt/homebrew/bin/composer "$@"
}
function vcomposer() {
valet composer "$@"
}
function cat() {
bat --theme ansi "$@"
}
function ghr() {
gh repo clone roundly-consulting/$1
cd $1
}
function ghl() {
gh repo create roundly-consulting/$1 --private --template spatie/package-skeleton-laravel
ghr $1
pstorm .
}
man() {
env \
LESS_TERMCAP_mb=$(printf "\e[1;31m") \
LESS_TERMCAP_md=$(printf "\e[1;31m") \
LESS_TERMCAP_me=$(printf "\e[0m") \
LESS_TERMCAP_se=$(printf "\e[0m") \
LESS_TERMCAP_so=$(printf "\e[1;44;33m") \
LESS_TERMCAP_ue=$(printf "\e[0m") \
LESS_TERMCAP_us=$(printf "\e[1;32m") \
man "$@"
}
function mk() {
mkdir -p "$@" && cd "$@"
}
function e() {
if [[ ! -f .env ]]; then
echo -e "${RED}Error: .env file does not exists${NC}" && return
fi
cat .env @ $1
}
extract () {
if [ -f $1 ]; then
case $1 in
*.tar.bz2) tar -jxvf $1 ;;
*.tar.gz) tar -zxvf $1 ;;
*.bz2) bunzip2 $1 ;;
*.dmg) hdiutil mount $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar -xvf $1 ;;
*.tbz2) tar -jxvf $1 ;;
*.tgz) tar -zxvf $1 ;;
*.zip) unzip $1 ;;
*.ZIP) unzip $1 ;;
*.pax) cat $1 | pax -r ;;
*.pax.Z) uncompress $1 --stdout | pax -r ;;
*.rar) unrar x $1 ;;
*.Z) uncompress $1 ;;
*) echo -e "${RED}Error: '$1' cannot be extracted/mounted via extract()${NC}" ;;
esac
else
echo "${RED}Error: '$1' is not a valid file${NC}"
fi
}
function xterm_title_precmd () {
print -Pn '\e]2;%~\a'
}
function xterm_title_preexec () {
print -Pn '\e]2;'
print -n "${(q)1}\a"
}
function youtube_song () {
youtube-dl --audio-format m4a -x "$@"
}
function joke() {
echo $(curl -s https://icanhazdadjoke.com)
}