Skip to content

Commit

Permalink
Merge pull request #42 from Qubut/fix-functional-helpers
Browse files Browse the repository at this point in the history
fix(grimshot): resolve missing functional-helpers file error (#40)
  • Loading branch information
OctopusET authored Nov 17, 2024
2 parents 4ee1c80 + 01481bd commit 9b3bc3e
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion grimshot/grimshot
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,39 @@
## Those are needed to be installed, if unsure, run `grimshot check`
##
## See `man 1 grimshot` or `grimshot usage` for further details.
. ./functional-helpers

when() {
condition=$1
action=$2

if eval "$condition"; then
eval "$action"
fi
}

whenOtherwise() {
condition=$1
true_action=$2
false_action=$3

if eval "$condition"; then
eval "$true_action"
else
eval "$false_action"
fi
}

any() {
for tuple in "$@"; do
condition=$(echo "$tuple" | cut -d: -f1)
action=$(echo "$tuple" | cut -d: -f2-)
if eval "$condition"; then
eval "$action"
return 0
fi
done
return 1 # No conditions matched
}

NOTIFY=no
CURSOR=
Expand Down

0 comments on commit 9b3bc3e

Please sign in to comment.