aboutsummaryrefslogtreecommitdiff
path: root/functions/alert.fish
diff options
context:
space:
mode:
authorDeposite Pirate2026-02-16 02:22:00 +0100
committerDeposite Pirate2026-02-16 02:22:00 +0100
commite5d665865e7cc800bb4deecd6aedcf3015e65b10 (patch)
tree831b1c0adbd2aa8d2bb80ff2ae8c6bd7f4d8513d /functions/alert.fish
parent7cfcd5a663a61e14de445426ea3f794e6b91fdda (diff)
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
Diffstat (limited to 'functions/alert.fish')
-rw-r--r--functions/alert.fish34
1 files changed, 18 insertions, 16 deletions
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