forked from elementor/elementor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathincludes.sh
53 lines (47 loc) · 1.04 KB
/
includes.sh
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
#!/bin/bash
# credit: "https://github.com/WordPress/gutenberg"
# under GPL license
##
# Tests if running on windows
#
# @return {bool} If running on windows
##
is_windows() {
command_exists "systeminfo"
}
##
# Add error message formatting to a string, and echo it.
#
# @param {string} message The string to add formatting to.
##
error_message() {
echo -en "\033[31mERROR\033[0m: $1"
}
##
# Add status message formatting to a string, and echo it.
#
# @param {string} message The string to add formatting to.
##
status_message() {
echo -en "\033[32mSTATUS\033[0m: $1"
}
##
# Add formatting to an action string.
#
# @param {string} message The string to add formatting to.
##
action_format() {
echo -en "\033[32m$1\033[0m"
}
##
# Check if the command exists as some sort of executable.
#
# The executable form of the command could be an alias, function, builtin, executable file or shell keyword.
#
# @param {string} command The command to check.
#
# @return {bool} Whether the command exists or not.
##
command_exists() {
type -t "$1" >/dev/null 2>&1
}