Skip to content

Commit b318116

Browse files
committed
Math: Add "Calculate Growth %" script
1 parent b012cd9 commit b318116

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

commands/math/calculate-growth.sh

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
3+
# Required parameters:
4+
# @raycast.schemaVersion 1
5+
# @raycast.title Calculate Growth %
6+
# @raycast.mode compact
7+
8+
# Optional parameters:
9+
# @raycast.icon 📈
10+
# @raycast.argument1 { "type": "text", "placeholder": "From" }
11+
# @raycast.argument2 { "type": "text", "placeholder": "To" }
12+
13+
# Documentation:
14+
# @raycast.author Petr Nikolaev
15+
# @raycast.authorURL https://github.com/pitnikola
16+
# @raycast.description Calculate percentage increase between "from" and "to" values.
17+
18+
GROWTH=$(echo "($2 / $1 - 1) * 100" | bc -l)
19+
GROWTH=$(printf "%.1f" $GROWTH)
20+
echo "$GROWTH" | pbcopy
21+
echo "Growth from $1 to $2 is $GROWTH%. Copied to clipboard."

0 commit comments

Comments
 (0)