diff --git a/fuzzy-pokedex b/fuzzy-pokedex index dc0886a..081a7ae 100755 --- a/fuzzy-pokedex +++ b/fuzzy-pokedex @@ -1,5 +1,17 @@ #!/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 \ @@ -18,13 +30,14 @@ pokedex() { --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};'| - awk '{ printf "%s", $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/{} @@ -35,7 +48,7 @@ if [[ ! "$1" =~ ^- ]]; then else for opt in "$@"; do case $opt in - -u|--aur) + -u|--update) update_pokeData ;; -h|--help)