diff --git a/PKGBUILD b/PKGBUILD index 945c563..efcfcf8 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -24,6 +24,7 @@ pkgver(){ package() { cd "$srcdir/$pkgname" install -Dm666 pokeData/* -t "$pkgdir/usr/share/$pkgname/pokeData" + install -Dm666 keybinds-preview -t "$pkgdir/usr/share/$pkgname/" install -Dm755 pokedex -t "$pkgdir/usr/bin" install -Dm755 pokeInfo -t "$pkgdir/usr/bin" } diff --git a/keybindings-preview b/keybindings-preview new file mode 100644 index 0000000..67fdeb6 --- /dev/null +++ b/keybindings-preview @@ -0,0 +1,9 @@ + + KEYBINDS + + space Reads the Pokedex entry + ctrl-space Stops reading the Pokedex entry + ctrl-n Shows small sprite version + ctrl-b Shows large sprite version + ctrl-s Shows shiny sprite version + ctrl-h Shows this help screen in preview window diff --git a/pokedex b/pokedex index 60c0cbd..88dde96 100755 --- a/pokedex +++ b/pokedex @@ -1,16 +1,27 @@ #!/bin/bash +### Overhad preparation +KBINDS="/usr/share/fuzzy-pokedex/keybindings-preview" +POKEDATA="/usr/share/fuzzy-pokedex/pokeData" + ### Help help() { printf "\n%s\n%s\n\n" "Use fzf to search Pokemon stats" "Can optionally search by name" - printf "%s\n\t%s\n\n%s" "EXAMPLE" "pokedex [pokemon name]" - printf "%s\n\t%s\n\t\t%s\n\t%s\n\t\t%s\n\t\t%s\n\t\t%s\n\t\t%s\n\t%s\n\t\t%s\n\n" "OPTIONS" "-q, --quick [pokemon]" "Prints single pokedex entry to terminal" "-u, --update [N/+N/-N/N%]" "Scrape web for updated Pokemon stats" "WARNING: update function is resource heavy" "See Parallel job control (-j) for options" "Default is 200%" "-h, --help" "Print this help screen" - printf "%s\n\t%s\t%s\n\t%s\t%s\n\t%s\t%s\n\t%s\t%s\n\t%s\t%s\n\t%s\t%s\n" "KEYBINDS" "space" "Reads the Pokedex entry" "ctrl-space" "Stops reading the Pokedex entry" "ctrl-n" "Shows small sprite version" "ctrl-b" "Shows large sprite version" "ctrl-s" "Shows shiny sprite version" "ctrl-h" "Shows this help screen in preview window" + printf "%s\n\t%s\n\n" "EXAMPLE" "pokedex [pokemon name]" + printf "%s\n" "OPTIONS" + printf "%-25s\t%s\n" " -q, --quick [pokemon]" "Prints single pokedex entry to terminal" \ + " -u, --update [N/+N/-N/N%]" "Scrape web for updated Pokemon stats" "" " WARNING: update function is resource heavy" "" " See Parallel job control (-j) for options" "" " Default is 200%" \ + " -h, --help" "Print this help screen" + printf "\n%s\n" "KEYBINDS" + printf "%-15s\t%s\n" " space" "Reads the Pokedex entry" \ + " ctrl-space" "Stops reading the Pokedex entry" \ + " ctrl-n" "Shows small sprite version" \ + " ctrl-b" "Shows large sprite version" \ + " ctrl-s" "Shows shiny sprite version" \ + " ctrl-h" "Shows this help screen in preview window" + printf "\n" } -### Set pokeData location -POKEDATA="/usr/share/fuzzy-pokedex/pokeData" - ### Pokedex viewer using pokemon-colorscripts and fzf pokedex() { pokemon-colorscripts -l | @@ -30,7 +41,7 @@ pokedex() { --preview="echo; pokemon-colorscripts -n {1} --no-title; cat $POKEDATA/{1}" \ --preview-window=68%:wrap:border-rounded \ --bind=focus:transform-preview-label:'echo [ {1} ] ' \ - --bind=ctrl-h:preview:"echo; pokedex -h;" \ + --bind=ctrl-h:preview:"cat $KBINDS" \ --bind=space:preview:"echo; pokemon-colorscripts -n {1} --no-title; cat $POKEDATA/{1}; espeak-ng -f $POKEDATA/{1} -g 2 -p 45 -s 160 -l 150 -ven+m3 &" \ --bind=ctrl-space:preview:"echo; pokemon-colorscripts -n {1} --no-title; cat $POKEDATA/{1};" \ --bind=ctrl-b:preview:"echo; pokemon-colorscripts -b -n {1} --no-title; cat $POKEDATA/{1};" \ @@ -50,6 +61,7 @@ update_pokeData() { pokemon-colorscripts -l | sort | parallel --bar --color --retry-failed -j "${1:-200%}" pokeInfo {} ">" "$POKEDATA/{}" 2>&1 } +### Arg parsing loop if [[ ! "$1" =~ ^- ]]; then pokedex "$1" else