summaryrefslogtreecommitdiff
path: root/bin/extra/p.sh
diff options
context:
space:
mode:
authorRaymaekers Luca <raymaekers.luca@gmail.com>2024-02-14 02:23:53 +0100
committerRaymaekers Luca <raymaekers.luca@gmail.com>2024-02-14 02:23:53 +0100
commitf5526c4cfbe0803212050dc53a487e5c3b38bd4b (patch)
tree2ba0b97fbd1a6ac4f3ae4b529da0d21570a3f4b8 /bin/extra/p.sh
parent991fc41022fbdf7da399eb8ea53b3c67d0239d47 (diff)
Update scripts
Diffstat (limited to 'bin/extra/p.sh')
-rwxr-xr-xbin/extra/p.sh27
1 files changed, 27 insertions, 0 deletions
diff --git a/bin/extra/p.sh b/bin/extra/p.sh
new file mode 100755
index 0000000..010ae0c
--- /dev/null
+++ b/bin/extra/p.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+ask_pokemon() { commander -xc < ./pokemon_bw.txt; }
+
+html="/tmp/pk_tmp.html"
+[ "$pokemon" ] || pokemon="$(ask_pokemon)"
+[ "$pokemon" ] || exit 1
+
+case "$1" in
+ # evolution
+ e*)
+ url="https://pokemondb.net/pokedex/$pokemon"
+ curl -Ls "$url" > "$html"
+ level1="$(pup -p 'span.infocard:nth-child(2) > small:nth-child(2) text{}' < "$html")"
+ level2="$(pup -p 'span.infocard:nth-child(4) > small:nth-child(2) text{}' < "$html")"
+ notify-send "p.sh" "$level1\n$level2"
+ ;;
+
+ # moves
+ m*) $BROWSER "https://bulbapedia.bulbagarden.net/wiki/${pokemon}_(Pok%C3%A9mon)/Generation_V_learnset" ;;
+
+ # stats
+ s*) $BROWSER "https://www.smogon.com/dex/bw/pokemon/$pokemon/" ;;
+ *)
+ choice="$(printf 'evolution\nmoves\nstats\n' | commander -c -w 3)"
+ [ "$choice" ] && pokemon="$pokemon" $0 "$choice" ;;
+esac