changes.
This commit is contained in:
parent
d3d137a22b
commit
db7ac16675
3 changed files with 83 additions and 24 deletions
|
@ -1,3 +1,11 @@
|
|||
# Define color variables
|
||||
RED='\033[0;31m'
|
||||
YELLOW='\033[0;33m'
|
||||
CYAN='\033[0;36m'
|
||||
GREEN='\033[1;32m'
|
||||
NC='\033[0m' # No Color
|
||||
BOLD='\033[1m'
|
||||
|
||||
# INFO:
|
||||
# ╭──────────╮
|
||||
# │ defaults │
|
||||
|
@ -587,6 +595,37 @@ missing() {
|
|||
done
|
||||
}
|
||||
|
||||
# INFO:
|
||||
# ╭─────────────────╮
|
||||
# │ other functions │
|
||||
# ╰─────────────────╯
|
||||
source-script() {
|
||||
local url="$1"
|
||||
local import="$(mktemp)"
|
||||
|
||||
# ─< if $1 is a local file, source this one instead >─────────────────────────────────────
|
||||
if [ -f "$url" ]; then
|
||||
source "$url"
|
||||
sleep 0.1
|
||||
return 0
|
||||
else
|
||||
echo_info "Sourcing external script:${NC} $url"
|
||||
# ─< if $1 is a url, grab it and source it, also deletes afterwards >─────────────────────
|
||||
if command_exists curl; then
|
||||
curl -fsSL $url -o $import
|
||||
elif command_exists wget; then
|
||||
wget -o $import $url
|
||||
else
|
||||
echo "curl/wget is required, but missing.."
|
||||
exit 69
|
||||
fi
|
||||
|
||||
source "$import"
|
||||
sleep 0.1
|
||||
rm -f "$import"
|
||||
fi
|
||||
}
|
||||
|
||||
main() {
|
||||
# ─< g stands for GIT >─────────────────────────────────────────────────────────────────────
|
||||
if command_exists git; then
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue