aboutsummaryrefslogtreecommitdiff
path: root/functions/alert.fish
diff options
context:
space:
mode:
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