64 lines
2.3 KiB
Bash
Executable File
64 lines
2.3 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
### Help
|
|
Help() {
|
|
echo -e "\nUse fzf to search and Pokemon stats\n"
|
|
echo -e "Can optionally search by name"
|
|
echo -e "EXAMPLE\n\tfuzzy-pokedex [pokemon name]\n"
|
|
echo -e "OPTIONS"
|
|
echo -e "\t-u, --update\n\t\tScrape web for updated Pokemon stats\n\t\tWARNING: update function is resource heavy\n\t-h, --help\n\t\tPrint this help screen"
|
|
echo -e "KEYBINDS"
|
|
echo -e "\tctrl-n\tShows small sprite version\n\tctrl-b\tShows large sprite version\n\tctrl-s\tShows shiny sprite version\n\tctrl-h\tShows this help screen in preview window\n"
|
|
}
|
|
|
|
### Pokedex viewer using pokemon-colorscripts and fzf
|
|
pokedex() {
|
|
pokemon-colorscripts -l |
|
|
fzf +m -s -i \
|
|
--cycle \
|
|
--reverse \
|
|
--prompt=' ' \
|
|
--pointer=' ' \
|
|
--border=rounded \
|
|
--border-label="╢ Fuzzy-Pokedex ╟" \
|
|
--margin=4% \
|
|
--padding=4% \
|
|
--header="Choose Pokemon to view info" \
|
|
--info=inline:' ' \
|
|
--color='fg+:15,fg:42,preview-fg:15,label:9,preview-label:15,hl+:134,hl:123,query:134,gutter:0,border:9,prompt:15,pointer:15,marker:15' \
|
|
--tiebreak=begin,chunk,length \
|
|
--preview="echo; pokemon-colorscripts -n {1} --no-title; cat /home/ez/Git/fuzzy-pokedex/pokeData/{1}" \
|
|
--preview-window=68%:wrap:border-rounded \
|
|
--bind=focus:transform-preview-label:'echo [ {1} ] ' \
|
|
--bind=ctrl-h:preview:'echo; ./fuzzy-pokedex -h;' \
|
|
--bind=ctrl-b:preview:'echo; pokemon-colorscripts -b -n {1} --no-title; cat /home/ez/Git/fuzzy-pokedex/pokeData/{1};' \
|
|
--bind=ctrl-s:preview:'echo; pokemon-colorscripts -s -n {1} --no-title; cat /home/ez/Git/fuzzy-pokedex/pokeData/{1};' \
|
|
--bind=ctrl-n:preview:'echo; pokemon-colorscripts -n {1} --no-title; cat /home/ez/Git/fuzzy-pokedex/pokeData/{1};' |
|
|
parallel pokemon-colorscripts --no-title -n {} "&&" cat /home/ez/Git/fuzzy-pokedex/pokeData/{}
|
|
}
|
|
|
|
### Update Pokemon stats file set
|
|
update_pokeData() {
|
|
echo -e "\n\t\tWARNING!!!\n\tThis WILL take a long time\n"
|
|
pokemon-colorscripts -l | sort | parallel --bar --color -j 200% /home/ez/Git/fuzzy-pokedex/pokeinfo {} ">" /home/ez/Git/pokedex/pokeData/{}
|
|
}
|
|
|
|
if [[ ! "$1" =~ ^- ]]; then
|
|
pokedex
|
|
else
|
|
for opt in "$@"; do
|
|
case $opt in
|
|
-u|--update)
|
|
update_pokeData
|
|
;;
|
|
-h|--help)
|
|
Help
|
|
;;
|
|
-*)
|
|
echo "Invalid Usage"
|
|
Help
|
|
;;
|
|
esac
|
|
done
|
|
fi
|