From 53508118a2f34a894881064bd04fca8a2f055a6a Mon Sep 17 00:00:00 2001 From: pika Date: Sun, 18 May 2025 12:56:45 +0200 Subject: [PATCH] testing --- yazi.sh | 39 ++++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/yazi.sh b/yazi.sh index 32aee74..e837bb0 100644 --- a/yazi.sh +++ b/yazi.sh @@ -1,19 +1,35 @@ { #!/usr/bin/env bash - PACKAGE=yazi - # ─< Check if the given command exists silently >───────────────────────────────────────── command_exists() { command -v "$@" >/dev/null 2>&1 } - if command_exists $PACKAGE; then - echo_error "$PACKAGE is already installed!" - echo_error "Exiting now!" - return 69 + # ─< package variable >─────────────────────────────────────────────────────────────────── + unset PACKAGE + + # ─< 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 + # ─< parse arguments and get variable contents >────────────────────────────────────────── + for arg in "$@"; do + case "$arg" in + --silent | -s) + silent=true + ;; + esac + done + # WHY: # This import will give you the following variables: # _sudo="sudo -E" <- only if non root user @@ -98,6 +114,10 @@ } main() { + if $silent; then + echo_warning "Executing script silently!" + fi + if $arch; then _install yazi elif ! $opensuse; then @@ -108,13 +128,6 @@ } if getImports; then - case "$@" in - --silent | -s) - silent=true - echo_warning "Executing script silently.." - ;; - *) silent=false ;; - esac main fi }