fixed keybinds only preview/printf commands

This commit is contained in:
Eric Lay 2023-04-21 09:27:44 -05:00
parent 1d6c844dfb
commit 342fffc174
3 changed files with 29 additions and 7 deletions

View File

@ -24,6 +24,7 @@ pkgver(){
package() { package() {
cd "$srcdir/$pkgname" cd "$srcdir/$pkgname"
install -Dm666 pokeData/* -t "$pkgdir/usr/share/$pkgname/pokeData" 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 pokedex -t "$pkgdir/usr/bin"
install -Dm755 pokeInfo -t "$pkgdir/usr/bin" install -Dm755 pokeInfo -t "$pkgdir/usr/bin"
} }

9
keybindings-preview Normal file
View File

@ -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

26
pokedex
View File

@ -1,16 +1,27 @@
#!/bin/bash #!/bin/bash
### Overhad preparation
KBINDS="/usr/share/fuzzy-pokedex/keybindings-preview"
POKEDATA="/usr/share/fuzzy-pokedex/pokeData"
### Help ### Help
help() { help() {
printf "\n%s\n%s\n\n" "Use fzf to search Pokemon stats" "Can optionally search by name" 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\n" "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" "OPTIONS"
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 "%-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 viewer using pokemon-colorscripts and fzf
pokedex() { pokedex() {
pokemon-colorscripts -l | pokemon-colorscripts -l |
@ -30,7 +41,7 @@ pokedex() {
--preview="echo; pokemon-colorscripts -n {1} --no-title; cat $POKEDATA/{1}" \ --preview="echo; pokemon-colorscripts -n {1} --no-title; cat $POKEDATA/{1}" \
--preview-window=68%:wrap:border-rounded \ --preview-window=68%:wrap:border-rounded \
--bind=focus:transform-preview-label:'echo [ {1} ] ' \ --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=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-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};" \ --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 pokemon-colorscripts -l | sort | parallel --bar --color --retry-failed -j "${1:-200%}" pokeInfo {} ">" "$POKEDATA/{}" 2>&1
} }
### Arg parsing loop
if [[ ! "$1" =~ ^- ]]; then if [[ ! "$1" =~ ^- ]]; then
pokedex "$1" pokedex "$1"
else else