fix
This commit is contained in:
parent
2475615606
commit
3c154ef863
1 changed files with 10 additions and 104 deletions
114
.bashrc
114
.bashrc
|
@ -71,7 +71,7 @@ _sources() {
|
|||
for _s in "${sourceOptions[@]}"; do
|
||||
local _sourceFile="${sourceDir}/.${_s}.sh"
|
||||
if [ -e "$_sourceFile" ]; then
|
||||
. $_sourceFile
|
||||
. "$_sourceFile"
|
||||
fi
|
||||
local _source_""
|
||||
done
|
||||
|
@ -130,11 +130,13 @@ _blesh() {
|
|||
fi
|
||||
}
|
||||
|
||||
_games() {
|
||||
if command_exists curl; then
|
||||
echo_info "Games available. Try 'alias | grep g'"
|
||||
alias g2048='bash --norc -c "$(curl -sSL https://git.k4li.de/pika/scripts/raw/branch/main/bash/games/2048.sh)"'
|
||||
alias gwordle='bash --norc -c "$(curl -sSL https://git.k4li.de/pika/scripts/raw/branch/main/bash/games/wordle.sh)"'
|
||||
_env() {
|
||||
if command_exists nvim; then
|
||||
export EDITOR="$(which nvim)"
|
||||
elif command_exists vim; then
|
||||
export EDITOR="$(which vim)"
|
||||
elif command_exists vi; then
|
||||
export EDITOR="$(which vi)"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -193,109 +195,13 @@ _end() {
|
|||
print_echo_messages
|
||||
}
|
||||
|
||||
# ╭────────╮
|
||||
# │ CODING │
|
||||
# ╰────────╯
|
||||
_coding_() {
|
||||
# ─< h stands for HUGO >──────────────────────────────────────────────────────────────────
|
||||
if command_exists hugo; then
|
||||
alias h='hugo'
|
||||
alias hs='hugo server -D --noHTTPCache --disableFastRender'
|
||||
fi
|
||||
# Function to get the IP address
|
||||
get_ip() {
|
||||
ip a | grep 'inet ' | grep -v '127.0.0.1' | awk '{print $2}' | cut -d/ -f1 | head -n 1
|
||||
}
|
||||
|
||||
# Check if php is available, then create the alias
|
||||
if command -v php >/dev/null 2>&1; then
|
||||
alias phprun="php artisan serve --host=$(get_ip) --port=8000"
|
||||
fi
|
||||
|
||||
# Check if npm is available, then create the alias
|
||||
if command -v npm >/dev/null 2>&1; then
|
||||
alias npmrun="npm run dev -- --host=$(get_ip) --port=8001"
|
||||
fi
|
||||
}
|
||||
|
||||
get_packager() {
|
||||
. /etc/os-release
|
||||
case "$ID" in
|
||||
# Debian-based
|
||||
ubuntu | debian | pop | kali | zorin | rhinoh | raspbian)
|
||||
if command_exists nala; then
|
||||
alias search="nala search"
|
||||
alias install="$_sudo nala install --assume-yes"
|
||||
alias update="$_sudo nala update && $_sudo nala upgrade --full"
|
||||
alias remove="$_sudo nala purge"
|
||||
else
|
||||
alias search="apt-cache search"
|
||||
alias install="$_sudo apt-get install --yes"
|
||||
alias update="$_sudo apt-get update && $_sudo apt-get upgrade"
|
||||
alias remove="$_sudo apt-get purge"
|
||||
fi
|
||||
alias unbreak="$_sudo dpkg --configure -a"
|
||||
;;
|
||||
|
||||
# Arch-based
|
||||
arch | manjaro | endevouros | garuda)
|
||||
if command_exists paru; then
|
||||
alias search="paru -Ss"
|
||||
alias install="paru -S --noconfirm"
|
||||
alias update="paru -Syu"
|
||||
alias remove="paru -R"
|
||||
elif command_exists yay; then
|
||||
alias search="yay -Ss"
|
||||
alias install="yay -S --noconfirm"
|
||||
alias update="yay -Syu"
|
||||
alias remove="yay -R"
|
||||
else
|
||||
alias search="$_sudo pacman -Ss"
|
||||
alias install="$_sudo pacman -S --noconfirm"
|
||||
alias update="$_sudo pacman -Syu"
|
||||
alias remove="$_sudo pacman -R"
|
||||
fi
|
||||
;;
|
||||
|
||||
# RHEL-based
|
||||
fedora | centos)
|
||||
alias search="dnf search"
|
||||
alias install="$_sudo dnf install"
|
||||
alias update="$_sudo dnf update"
|
||||
alias remove="$_sudo dnf remove"
|
||||
;;
|
||||
|
||||
# openSUSE
|
||||
opensuse-*)
|
||||
alias search="zypper search"
|
||||
alias install="$_sudo zypper install --no-confirm"
|
||||
alias update="$_sudo zypper update"
|
||||
alias remove="$_sudo zypper remove"
|
||||
;;
|
||||
|
||||
# Alpine
|
||||
alpine)
|
||||
alias install="$_sudo apk add"
|
||||
alias update="$_sudo apk update && $_sudo apk upgrade"
|
||||
alias remove="$_sudo apk del"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
get_alias() {
|
||||
_sensible.bash_
|
||||
_coding_
|
||||
_alias
|
||||
_games
|
||||
}
|
||||
|
||||
main() {
|
||||
_env
|
||||
_sources
|
||||
_blesh
|
||||
_init
|
||||
_color_prompt_
|
||||
check_root
|
||||
get_packager
|
||||
get_alias
|
||||
_end
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue