addet install function
This commit is contained in:
parent
9dce1b1728
commit
60239b7a48
2 changed files with 70 additions and 1 deletions
63
.bash/.installs.sh
Normal file
63
.bash/.installs.sh
Normal file
|
@ -0,0 +1,63 @@
|
|||
#!/bin/bash
|
||||
# ─< Helper functions >─────────────────────────────────────────────────────────────────
|
||||
declare -a echo_messages
|
||||
|
||||
function echo_error() {
|
||||
local message="\033[0;1;31m❌ ERROR:\033[0;31m\t${*}\033[0m"
|
||||
echo -e "$message"
|
||||
echo_messages+=("$message")
|
||||
}
|
||||
|
||||
# Function to print all stored messages
|
||||
function print_echo_messages() {
|
||||
echo -e "\033[38;5;196mL\033[38;5;202mo\033[38;5;208mg\033[38;5;214m \033[38;5;220mo\033[38;5;226mu\033[38;5;118mt\033[38;5;46mp\033[38;5;48mu\033[38;5;51mt\033[38;5;45m:"
|
||||
for msg in "${echo_messages[@]}"; do
|
||||
echo -e "$msg"
|
||||
done
|
||||
}
|
||||
|
||||
# ─< Check if the given command exists silently >─────────────────────────────────────────
|
||||
command_exists() {
|
||||
command -v "$@" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
packages=(
|
||||
"brave"
|
||||
"docker"
|
||||
"neovide"
|
||||
"neovim"
|
||||
"xmrig"
|
||||
"yazi"
|
||||
"ytgo"
|
||||
)
|
||||
|
||||
_help() {
|
||||
echo "Just use _install 'packagename' to install some packages"
|
||||
echo "Available packages are:"
|
||||
echo "${packages[@]}"
|
||||
}
|
||||
|
||||
_install_func() {
|
||||
curl -fsSL "https://git.k4li.de/pika/scripts/raw/branch/main/bash/installs/${1}.sh" | sh
|
||||
}
|
||||
|
||||
_check() {
|
||||
if ! command_exists curl; then
|
||||
echo_error "curl was not found on this system!"
|
||||
echo_error "exiting now!"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
_install() {
|
||||
case "$1" in
|
||||
--help | -h)
|
||||
_help
|
||||
;;
|
||||
*)
|
||||
if _check; then
|
||||
_install_func "$1"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
}
|
8
.bashrc
8
.bashrc
|
@ -203,6 +203,11 @@ _init() {
|
|||
fi
|
||||
fi
|
||||
|
||||
if [ -e "$HOME/.bash/.install.sh" ]; then
|
||||
echo_info "Git installs activated by '_install <package>'"
|
||||
. "$HOME/.bash/.install.sh"
|
||||
fi
|
||||
|
||||
local bash_dir="$HOME/.bash/plugins"
|
||||
if [ -d "$bash_dir" ]; then
|
||||
echo_info "Plugins will be loadet.."
|
||||
|
@ -229,7 +234,8 @@ _init() {
|
|||
|
||||
_alias() {
|
||||
# ─< set keybinding mode >────────────────────────────────────────────────────────────────
|
||||
set -o emacs
|
||||
# set -o emacs
|
||||
set -o bash
|
||||
# set -o vim
|
||||
|
||||
# If set, the pattern "**" used in a pathname expansion context will
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue