From e5d665865e7cc800bb4deecd6aedcf3015e65b10 Mon Sep 17 00:00:00 2001 From: Deposite Pirate Date: Mon, 16 Feb 2026 02:22:00 +0100 Subject: Best effort dependency resolution Add a new check_install function that checks if a tool is installed and tries to install it on a best effort basic. Modify all scripts that benefit from it. Small indentation and correctness fixes. modified: functions/7za.fish modified: functions/alert.fish new file: functions/check_install.fish modified: functions/lscmd.fish modified: functions/rchmod.fish modified: functions/renlow.fish modified: functions/rlsxattr.fish modified: functions/rsdos.fish modified: functions/rsmac.fish modified: functions/rsxattr.fish modified: functions/uz.fish --- functions/alert.fish | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) (limited to 'functions/alert.fish') diff --git a/functions/alert.fish b/functions/alert.fish index 6ab53cb..a21deac 100644 --- a/functions/alert.fish +++ b/functions/alert.fish @@ -1,22 +1,24 @@ function alert --description 'Report status of command to desktop' - set -l cmd $argv - set -l cmd_str (string join ' ' $cmd) - set -l output (eval $cmd 2>&1) - set -l retval $status - if functions -q notify - if test $retval -eq 0 - notify "✅ Done: $cmd_str" "$output" - else - notify "❌ Failed $cmd_str" "$output" - end +set -l cmd $argv +set -l cmd_str (string join ' ' $cmd) +set -l output (eval $cmd 2>&1) +set -l retval $status + +if functions -q notify + if test $retval -eq 0 + notify "✅ Done: $cmd_str" "$output" + else + notify "❌ Failed $cmd_str" "$output" + end +else + if test $retval -eq 0 + printf "✅ Done: %s\n%s\n" "$cmd_str" "$output" else - if test $retval -eq 0 - printf "✅ Done: %s\n%s\n" "$cmd_str" "$output" - else - printf "❌ Failed: %s\n%s\n" "$cmd_str" "$output" - end + printf "❌ Failed: %s\n%s\n" "$cmd_str" "$output" end +end + +return $retval - return $retval end -- cgit v1.3.1