addet some functionality

This commit is contained in:
PieckA 2024-05-25 17:46:25 +02:00
parent a77e07b6e0
commit df727178f0
2 changed files with 72 additions and 69 deletions

View file

@ -10,13 +10,13 @@ end
# ╰───────────────────────────────────────────────────╯ # ╰───────────────────────────────────────────────────╯
# ────────────────────────────────────────< sources >────────────────────────────────────── # ────────────────────────────────────────< sources >──────────────────────────────────────
source ./functions/setup.fish source $HOME/.config/fish/functions/setup.fish
# ─────────────────────────────────< Environment-Variables >─────────────────────────────── # ─────────────────────────────────< Environment-Variables >───────────────────────────────
set -p EDITOR (which nvim) set -p EDITOR (which nvim)
# ────────────────────────────────────< setup some stuff >────────────────────────────────────
upin upin
# set_alias
dep_fisher dep_fisher
check_fisher check_fisher
plugs_fisher plugs_fisher
@ -176,4 +176,3 @@ $toolbox
$ALIASSES $ALIASSES
 
" "

View file

@ -5,17 +5,17 @@ function upin
# ─< check for sudo/root >────────────────────────────────────────────────────────────────── # ─< check for sudo/root >──────────────────────────────────────────────────────────────────
if [ $USER = "root" ] if [ $USER = "root" ]
set sudo "" set su ""
else else
if command -v sudo >/dev/null 2>&1 if command -v sudo >/dev/null 2>&1
set sudo "sudo" set su "sudo"
end end
end end
# ─────────────────────────< START | distro/packagemanger detection >───────────────────────── # ─────────────────────────< START | distro/packagemanger detection >─────────────────────────
# ─< DNF - Fedora >───────────────────────────────────────────────────── # ─< DNF - Fedora >─────────────────────────────────────────────────────
if command -v dnf if command -v dnf
set pkg "$sudo dnf" set pkg "$su dnf"
set install "$pkg install" set install "$pkg install"
set update "$pkg update && $pkg upgrade" set update "$pkg update && $pkg upgrade"
set search "$pkg search" set search "$pkg search"
@ -25,15 +25,15 @@ function upin
# ─< APT/NALA - Debian >──────────────────────────────────────────────── # ─< APT/NALA - Debian >────────────────────────────────────────────────
if command -v nala >/dev/null 2>&1 if command -v nala >/dev/null 2>&1
set pkg "$sudo nala" set pkg "$su nala"
set install "$pkg update && $pkg install" set install "$pkg update && $pkg install"
set update "$pkg update && $pkg upgrade" set update "$pkg update && $pkg upgrade"
set search "$pkg search" set search "$pkg search"
set remove "$pkg remove" set remove "$pkg remove"
set ALIASSES "-- You're using NALA aliases!! --" set ALIASSES "-- You're using NALA aliases!! --"
else else
if command -v apt-get >/dsudo ev/null 2>&1 if command -v apt-get >/dev/null 2>&1
set pkg "$sudo apt-get" set pkg "$su apt-get"
set install "$pkg update && $pkg install" set install "$pkg update && $pkg install"
set update "$pkg update && $pkg upgrade" set update "$pkg update && $pkg upgrade"
set search "$pkg search" set search "$pkg search"
@ -60,7 +60,7 @@ function upin
set ALIASSES "-- You're using Arch!! - installed helper: yay --" set ALIASSES "-- You're using Arch!! - installed helper: yay --"
else else
if command -v pacman >/dev/null 2>&1 if command -v pacman >/dev/null 2>&1
set pkg "$sudo pacman" set pkg "$su pacman"
set install "$pkg -S" set install "$pkg -S"
set update "$pkg -Syu" set update "$pkg -Syu"
set search "$pkg -Ss" set search "$pkg -Ss"
@ -72,7 +72,7 @@ function upin
# ─< Zypper - OpenSuse >──────────────────────────────────────────────────────────────────── # ─< Zypper - OpenSuse >────────────────────────────────────────────────────────────────────
if command -v zypper >/dev/null 2>&1 if command -v zypper >/dev/null 2>&1
set pkg "$sudo zypper" set pkg "$su zypper"
set install "$pkg in" set install "$pkg in"
set update "$pkg dup" set update "$pkg dup"
set search "$pkg se" set search "$pkg se"
@ -84,15 +84,14 @@ function upin
# ─< APK - Alpine >───────────────────────────────────────────────────────────────────────── # ─< APK - Alpine >─────────────────────────────────────────────────────────────────────────
if command -v apk >/dev/null 2>&1 if command -v apk >/dev/null 2>&1
set pkg "$sudo apk" set pkg "$su apk"
set install "$pkg add" set install "$pkg add"
set update "$pkg update" set update "$pkg update"
set search "$pkg search" set search "$pkg search"
set ALIASSES "-- Alpine.. right, this fast os is evolving.. --" set ALIASSES "-- Alpine.. right, this fast os is evolving.. --"
end end
if test -n "$install" if test -n "$install"
set FISH_INSTALL "$install" set -U FISH_INSTALL $install
set vars "install" "update" "search" "remove" set vars "install" "update" "search" "remove"
for env in $vars for env in $vars
if not test -z "$env" if not test -z "$env"
@ -100,24 +99,8 @@ function upin
end end
end end
end end
end end
# ╭───────────────────────────────────────────────╮
# │ FUNCTION: alias detection || depends on: upin │
# ╰───────────────────────────────────────────────╯
# function set_alias
# # ─< set variables to aliasses >────────────────────────────────────────────────────────────
# if upin
# set vars "install" "update" "search" "remove"
# for env in $vars
# if not test -z "$env"
# alias "$env"="$$env"
# end
# end
# end
# end
# ╭──────────────────────────────────────────────────────────────────────────────────────────────────────╮ # ╭──────────────────────────────────────────────────────────────────────────────────────────────────────╮
# │ FUNCTION: Define function gsa (to ask the user which submodule to clone to which path and which name │ # │ FUNCTION: Define function gsa (to ask the user which submodule to clone to which path and which name │
# ╰──────────────────────────────────────────────────────────────────────────────────────────────────────╯ # ╰──────────────────────────────────────────────────────────────────────────────────────────────────────╯
@ -194,7 +177,8 @@ function dep_fisher
if not command -v $dep >/dev/null 2>&1 if not command -v $dep >/dev/null 2>&1
echo "Dependency $dep is not installed. Installing..." echo "Dependency $dep is not installed. Installing..."
if test -n "$FISH_INSTALL" if test -n "$FISH_INSTALL"
$FISH_INSTALL $dep alias fish_install="$FISH_INSTALL"
fish_install $dep
else else
echo "FISH_INSTALL is not defined: $FISH_INSTALL | Please install $dep manually." echo "FISH_INSTALL is not defined: $FISH_INSTALL | Please install $dep manually."
end end
@ -205,14 +189,34 @@ end
# ╭───────────────────────────────────────────────────────╮ # ╭───────────────────────────────────────────────────────╮
# │ FUNCTION: check for fisher and install if not present │ # │ FUNCTION: check for fisher and install if not present │
# ╰───────────────────────────────────────────────────────╯ # ╰───────────────────────────────────────────────────────╯
function inst_fisher
fisher install jorgebucaran/fisher
end
function check_fisher function check_fisher
if not test -e $HOME/.config/fish/functions/fisher.fish switch $CHECK_FISHER
curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish | source case true
fisher update
case '*'
if test ! -e $HOME/.config/fish/functions/fisher.fish
curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish >> $HOME/.config/fish/functions/fisher.fish
else
fisher update >/dev/null 2>&1
switch $status
case 0
set -U CHECK_FISHER "true"
case '*'
inst_fisher
end end
end end
end
end
# ╭──────────────────────────────────╮ # ╭──────────────────────────────────╮
# │ FUNCTION: install fisher plugins │ # │ FUNCTION: install fisher plugins │
# ╰──────────────────────────────────╯ # ╰──────────────────────────────────╯
function plugs_fisher function plugs_fisher
# Define plugins to use with fisher # Define plugins to use with fisher
set plugins "PatrickF1/fzf.fish" "jorgebucaran/autopair.fish" set plugins "PatrickF1/fzf.fish" "jorgebucaran/autopair.fish"