Skip to content

Commit

Permalink
fix(grimshot): resolve missing functional-helpers file error (#40)
Browse files Browse the repository at this point in the history
- Fixed issue where the script failed to source the functional-helpers
file. By including it's functionality in the script itself

Closes #40.
  • Loading branch information
Qubut committed Oct 24, 2024
1 parent 8a9d0e4 commit 8bba26a
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 34 deletions.
33 changes: 0 additions & 33 deletions grimshot/functional-helpers

This file was deleted.

35 changes: 34 additions & 1 deletion grimshot/grimshot
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,40 @@
## 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 8bba26a

Please sign in to comment.