testing
This commit is contained in:
parent
ba44f7d655
commit
53508118a2
1 changed files with 26 additions and 13 deletions
39
yazi.sh
39
yazi.sh
|
@ -1,19 +1,35 @@
|
||||||
{
|
{
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
PACKAGE=yazi
|
|
||||||
|
|
||||||
# ─< Check if the given command exists silently >─────────────────────────────────────────
|
# ─< Check if the given command exists silently >─────────────────────────────────────────
|
||||||
command_exists() {
|
command_exists() {
|
||||||
command -v "$@" >/dev/null 2>&1
|
command -v "$@" >/dev/null 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
if command_exists $PACKAGE; then
|
# ─< package variable >───────────────────────────────────────────────────────────────────
|
||||||
echo_error "$PACKAGE is already installed!"
|
unset PACKAGE
|
||||||
echo_error "Exiting now!"
|
|
||||||
return 69
|
# ─< argument list variables >────────────────────────────────────────────────────────────
|
||||||
|
unset silent
|
||||||
|
|
||||||
|
sleep 0.1
|
||||||
|
|
||||||
|
PACKAGE=yazi
|
||||||
|
if command_exists "$PACKAGE"; then
|
||||||
|
echo_warning "$PACKAGE is already installed!"
|
||||||
|
echo_warning "Exiting now!"
|
||||||
|
exit 69
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# ─< parse arguments and get variable contents >──────────────────────────────────────────
|
||||||
|
for arg in "$@"; do
|
||||||
|
case "$arg" in
|
||||||
|
--silent | -s)
|
||||||
|
silent=true
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
# WHY:
|
# WHY:
|
||||||
# This import will give you the following variables:
|
# This import will give you the following variables:
|
||||||
# _sudo="sudo -E" <- only if non root user
|
# _sudo="sudo -E" <- only if non root user
|
||||||
|
@ -98,6 +114,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
|
if $silent; then
|
||||||
|
echo_warning "Executing script silently!"
|
||||||
|
fi
|
||||||
|
|
||||||
if $arch; then
|
if $arch; then
|
||||||
_install yazi
|
_install yazi
|
||||||
elif ! $opensuse; then
|
elif ! $opensuse; then
|
||||||
|
@ -108,13 +128,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if getImports; then
|
if getImports; then
|
||||||
case "$@" in
|
|
||||||
--silent | -s)
|
|
||||||
silent=true
|
|
||||||
echo_warning "Executing script silently.."
|
|
||||||
;;
|
|
||||||
*) silent=false ;;
|
|
||||||
esac
|
|
||||||
main
|
main
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue