diff options
| author | Deposite Pirate | 2025-10-16 19:30:01 +0200 |
|---|---|---|
| committer | Deposite Pirate | 2025-10-16 19:30:01 +0200 |
| commit | 517acf6ac9a9da29ac4cd52de2a52db5a8fab88a (patch) | |
| tree | 29c29eb348c0c77cc6588dd84f7054d53bc49d70 /functions | |
| parent | 1dfd92bdd350ff109d2cf2152e6a7d59f24f672f (diff) | |
Integrate utility functions
Add the ask function that just prompts for yes or no. Clean up and make
available the copy/paste/notify aliases to all scripts.
modified: conf.d/00functions.fish
modified: conf.d/05gui.fish
modified: functions/alert.fish
Diffstat (limited to 'functions')
| -rw-r--r-- | functions/alert.fish | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/functions/alert.fish b/functions/alert.fish index d4e17dc..6ab53cb 100644 --- a/functions/alert.fish +++ b/functions/alert.fish @@ -1,9 +1,22 @@ 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 test $status -eq 0 - notify "✅ Done" (history | head -n1) + if functions -q notify + if test $retval -eq 0 + notify "✅ Done: $cmd_str" "$output" + else + notify "❌ Failed $cmd_str" "$output" + end else - notify "❌ Failed" (history | head -n1) + 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 end + return $retval end |
