-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmoduler.sh
88 lines (76 loc) · 2.19 KB
/
moduler.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
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
#!/bin/bash
ll_ij="\e[92m"
ll_bi="\e[94m"
ll_me="\e[91m"
ll_ku="\e[94m"
ll_cy="\e[96m"
ll_st="\e[00m"
sys::@file(){
local __ll__str_arg="$(pwd)/lib/$1"
# local patch__ll__=$( cd "$(pwd)/${BASH_SOURCE[0]%/*}" )
# if [[ ! -f "${__ll__str_arg}" ]]; then
# echo "[**] Sepertinya tidak ada module $1"
# exit 1
# fi
for file in $(echo "$__ll__str_arg" | sed -e 's/.sh/''/g'); do
if [[ ! -f "${file}.sh" ]]; then
echo "[**] Sepertinya tidak ada module $@"
exit 2
fi
file=$(echo "${file}.sh")
# source "$file" "$@">/dev/null 2>&1 || {
# echo -e "[**] Error\n\t<Source Not found>\n\t<Source no indetifikasi>\n[ErrorSource]> sepertinya library tidak cocok dengan bash"
## exit 44
# }
builtin source "$file" "$@"
done
__ll__str_arg=(${__ll__str_arg})
}
shopt -s expand_aliases
#trap "Exception::err;echo;echo;/data/data/com.termux/files/usr/libexec/termux/command-not-found \"$1\"" ERR
#if [[ -x /data/data/com.termux/files/usr/libexec/termux/command-not-found ]]; then
@system::require(){
local file_patch="$1"
if [[ -d "$file_patch" ]]; then
if [[ ${reloading} != true ]] && [[ ! -z "${file_patch}" ]] && builtin source "$file_patch" || { echo "Nothing"; exit 5; }; then
return 2
fi
else
source $(pwd)/${file_patch}
fi
}
#fi
system::import(){
for libPatch in "$@"; do
sys::@file "$libPatch"
done
}
system::handle(){
local handlePatch
for handlePatch in "$@"; do
sys::@file "$handlePatch"
done
}
system.url(){
local url="$1"
if [[ -z "$url" ]]; then
echo -e "\e[93m[\e[91m•\e[92m•\e[93m]\e[0m url not found"
exit 23
fi;
if (type -a curl &> /dev/null); then
builtin source <(curl -sL --retry 3 --fail --url "$url") || { __e__="cannot import $url"; throw; }
else
builtin wget <(wget -t 3 -O - -o /dev/null "$url") || { __e__="connot import $url"; throw; }
fi
}
throw(){ eval 'echo -e "\e[96m[\e[91m•\e[92m•\e[96m]\e[00m $(cat <<< $__e__)"; read -s'; }
Namespace.self:(){ :; }
alias Bash.import:="system::import"
alias @require="reloading=true @system::require"
alias begin:="{"
alias __bash__="};"
alias DEBUG=": #"
alias DEBUG=": "
alias %%="#"
alias @import="system::handle"
alias Bash::url="system.url"