-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.zsh_functions
43 lines (36 loc) · 1.06 KB
/
.zsh_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
# Useful functions for use in the shell
# ===============================================================
# Colornames to colors
# ===============================================================
# RESET "\033[0m"
# BLACK "\033[30m"
# RED "\033[31m"
# GREEN "\033[32m"
# YELLOW "\033[33m"
# BLUE "\033[34m"
# MAGENTA "\033[35m"
# CYAN "\033[36m"
# WHITE "\033[37m"
# Usage: mkd <path/to/your/new/dir>
# Descripion: makes a directory (recursively down the path) and cds into it
function mkd() {
mkdir -p "$@" && cd "$@"
}
# Usage: info "<string>"
# Descripion: prints [ .. ] <string> \n (.. will be blue)
info () {
printf "\r [ \033[00;34m..\033[0m ] $1 \n"
}
# Usage: success "<string>"
# Descripion: prints [ OK ] <string> \n (OK will be green)
success () {
printf "\r\033[2K [ \033[00;32mOK\033[0m ] $1\n"
}
# Usage: fail "<string>"
# Descripion: prints [ FAIL ] <string> \n (FAIL will be red)
# then exits the script
fail () {
printf "\r\033[2K [\033[0;31mFAIL\033[0m] $1\n"
echo ''
exit
}