Skip to content

Commit fe55048

Browse files
committed
improved simple-entry.sh
1 parent bb1204e commit fe55048

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

simple-entry.sh

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,27 @@
22

33
######### YOUR CODES HERE #########
44

5-
sleep() { tip "sleeping..."; }
5+
sleepx() { tip "sleeping..." && (($#)) && \sleep "$@"; }
66

77
######### SIMPLE BASH.SH FOOTER BEGIN #########
88

9+
is_darwin() { [[ $OSTYPE == darwin* ]]; }
10+
is_darwin_sillicon() { is_darwin && [[ $(uname_mach) == arm64 ]]; }
11+
is_linux() { [[ $OSTYPE == linux* ]]; }
12+
is_freebsd() { [[ $OSTYPE == freebsd* ]]; }
13+
is_win() { in_wsl; }
14+
in_wsl() { [[ "$(uname -r)" == *windows_standard* ]]; }
15+
16+
is_git_clean() { git diff-index --quiet "$@" HEAD -- 2>/dev/null; }
17+
is_git_dirty() {
18+
if is_git_clean "$@"; then
19+
false
20+
else
21+
true
22+
fi
23+
}
24+
25+
###
926
# The better consice way to get baseDir, ie. $CD, is:
1027
# CD=$(cd `dirname "$0"`;pwd)
1128
# It will open a sub-shell to print the folder name of the running shell-script.
@@ -21,7 +38,7 @@ LS_OPT="--color" && is_darwin && LS_OPT="-G"
2138
(($#)) && {
2239
dbg "$# arg(s) | CD = $CD"
2340
check_entry() {
24-
local prefix="$1" cmd="$2" && shift && shift
41+
local prefix="${1:-boot}" cmd="${2:-first}" && shift && shift
2542
if fn_exists "${prefix}_${cmd}_entry"; then
2643
eval "${prefix}_${cmd}_entry" "$@"
2744
elif fn_exists "${cmd}_entry"; then

0 commit comments

Comments
 (0)