From 517acf6ac9a9da29ac4cd52de2a52db5a8fab88a Mon Sep 17 00:00:00 2001 From: Deposite Pirate Date: Thu, 16 Oct 2025 19:30:01 +0200 Subject: 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 --- functions/alert.fish | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'functions') 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 -- cgit v1.3.1