35 lines
1.6 KiB
Bash
Executable file
35 lines
1.6 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
# ─< Helper functions >─────────────────────────────────────────────────────────────────
|
|
function echo_error() { echo -e "\033[0;1;31mError: \033[0;31m\t${*}\033[0m"; }
|
|
function echo_binfo() { echo -e "\033[0;1;34mINFO: \033[0;34m\t${*}\033[0m"; }
|
|
function echo_info() { echo -e "\033[0;1;35mInfo: \033[0;35m${*}\033[0m"; }
|
|
|
|
# ─< Check if the given command exists silently >─────────────────────────────────────────
|
|
command_exists() {
|
|
command -v "$@" >/dev/null 2>&1
|
|
}
|
|
|
|
# ─< to get the alias to install everything either with your shell or inside your script! >─
|
|
if command_exists curl; then
|
|
install_pkg() {
|
|
bash --norc -c "$(curl -sSL https://git.k4li.de/pika/scripts/raw/branch/main/bash/snippets/install_pkg.sh)" "$@"
|
|
}
|
|
else
|
|
echo_error "curl is not installed, universal install disabled!"
|
|
fi
|
|
|
|
# ─< Silent execution >─────────────────────────────────────────────────────────────────
|
|
silentexec() {
|
|
"$@" >/dev/null 2>&1
|
|
}
|
|
|
|
mkdirs() {
|
|
# ─< .config dir >────────────────────────────────────────────────────────────────────────
|
|
if [[ ! -f $HOME/.config/ ]]; then
|
|
echo_binfo "mkdir $HOME/.config"
|
|
silentexec mkdir $HOME/.config
|
|
fi
|
|
}
|
|
|
|
mkdirs
|