sh: Use exist program
Fix sh module packages to make more extensive use of the exist program that also ships with the sh module. Simplifies intent of the code and makes it much easier to read.
This commit is contained in:
parent
ea95ca7dfa
commit
a27d86942b
3 changed files with 8 additions and 8 deletions
|
@ -61,6 +61,8 @@ if exist fzf; then
|
|||
fzf_pkg_tool=yay
|
||||
elif exist paru; then
|
||||
fzf_pkg_tool=paru
|
||||
elif exist pacman; then
|
||||
fzf_pkg_tool=pacman
|
||||
fi
|
||||
# shellcheck disable=2139 # we *want* this to be done at shell startup instead of dynamically
|
||||
if [ -n "$fzf_pkg_tool" ]; then
|
||||
|
@ -89,6 +91,4 @@ fi
|
|||
if exist vifm; then
|
||||
alias vm=vifm
|
||||
alias vmm='vifm ${PWD}'
|
||||
# enable picture preview script
|
||||
exist vifmrun && alias vifm=vifmrun
|
||||
fi
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/sh
|
||||
# more usage instructions at https://github.com/clvv/fasd
|
||||
# eval "$(fasd --init posix-hook posix_alias bash-hook zsh-hook zsh-ccomp zsh-ccomp-install zsh-wcomp zsh-wcomp-install)"
|
||||
type fasd >/dev/null 2>&1 && eval "$(fasd --init auto)"
|
||||
exist fasd && eval "$(fasd --init auto)"
|
||||
|
||||
# any
|
||||
alias a='fasd -a'
|
||||
|
|
|
@ -6,28 +6,28 @@
|
|||
# Also makes yay call paru since that is the new hotness
|
||||
# (or at least I want to try it)
|
||||
|
||||
type paru >/dev/null 2>&1 && {
|
||||
exist paru && {
|
||||
# recreate the normal look of yay
|
||||
alias yay="paru --bottomup"
|
||||
}
|
||||
|
||||
syu() {
|
||||
type topgrade >/dev/null 2>&1 && {
|
||||
exist topgrade && {
|
||||
topgrade
|
||||
return
|
||||
}
|
||||
|
||||
type paru >/dev/null 2>&1 && {
|
||||
exist paru && {
|
||||
paru
|
||||
return
|
||||
}
|
||||
|
||||
type yay >/dev/null 2>&1 && {
|
||||
exist yay && {
|
||||
yay
|
||||
return
|
||||
}
|
||||
|
||||
type pacman >/dev/null 2>&1 && {
|
||||
exist pacman && {
|
||||
echo "Did not find paru, or yay installed. Updates will not be applied to aur packages."
|
||||
sudo pacman -Syu
|
||||
return
|
||||
|
|
Loading…
Reference in a new issue