From 5580150e0bfbce3a714b601b0cd748db2b027ca5 Mon Sep 17 00:00:00 2001 From: Eric Lay Date: Sat, 22 Apr 2023 17:15:49 -0500 Subject: [PATCH] update to jqPokeTest(update function) --- jqPokeTest | 7 ++++--- pokedex-dev | 15 +++++++++------ 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/jqPokeTest b/jqPokeTest index 9a5fa7a..f6e6abf 100755 --- a/jqPokeTest +++ b/jqPokeTest @@ -8,8 +8,9 @@ COUNT="$WC" for POKEMON in $(pokemon-colorscripts -l); do ./jqPoke "$POKEMON" > "./pokeData/$POKEMON" - ((COUNT++)) - PCT="$((WC*100/COUNT))" - printf "%s \t%s%%\n" "$POKEMON" "$PCT" + ((COUNT--)) + PCTLEFT="$((COUNT*100/WC))" + PCTDONE="$((100-PCTLEFT))" + printf "\t%s - %s \t%s%%\n" "$COUNT" "$POKEMON" "$PCTDONE" done diff --git a/pokedex-dev b/pokedex-dev index b6ff8de..1cc6ee7 100755 --- a/pokedex-dev +++ b/pokedex-dev @@ -4,6 +4,7 @@ shopt -s extglob KBINDS="/usr/share/fuzzy-pokedex-dev/keybindings-preview" POKEDATA="/usr/share/fuzzy-pokedex-dev/pokeData" +indent="\n\t\t\t\t\t" ### Help help() { @@ -11,7 +12,9 @@ help() { 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%" \ + " -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" \ @@ -39,15 +42,15 @@ pokedex() { --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="printf '\n\t\t\t\t\t%s\n\t\t\t\t\t %s\n' 'Press space to hear entry' 'ctrl+space to stop'; pokemon-colorscripts -n {1} --no-title; cat $POKEDATA/{1}" \ + --preview="printf '${indent}%s${indent} %s\n' 'Press space to hear entry' 'ctrl+space to stop'; 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:"cat $KBINDS" \ - --bind=space:preview:"printf '\n\t\t\t\t %s\n\t\t\t\t\t %s\n' 'Select another Pokemon to stop audio' 'Or press ctrl+space'; pokemon-colorscripts -n {1} --no-title; cat $POKEDATA/{1}; espeak-ng -f $POKEDATA/{1} -g 4 -p 50 -s 145 -l 250 -ven+m3 &" \ - --bind=ctrl-space:preview:"printf '\n\t\t\t\t\t%s\n\t\t\t\t\t %s\n' 'Press space to hear entry' 'ctrl+space to stop'; pokemon-colorscripts -n {1} --no-title; cat $POKEDATA/{1};" \ + --bind=space:preview:"printf '${indent::-2} %s${indent} %s\n' 'Select another Pokemon to stop audio' 'Or press ctrl+space'; pokemon-colorscripts -n {1} --no-title; cat $POKEDATA/{1}; espeak-ng -f $POKEDATA/{1} -g 4 -p 50 -s 145 -l 250 -ven+m3 &" \ + --bind=ctrl-space:preview:"printf '${indent}%s${indent} %s\n' 'Press space to hear entry' 'ctrl+space to stop'; 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-s:preview:"echo; pokemon-colorscripts -s -n {1} --no-title; cat $POKEDATA/{1};" \ - --bind=ctrl-n:preview:"printf '\n\t\t\t\t\t%s\n\t\t\t\t\t %s\n' 'Press space to hear entry' 'ctrl+space to stop'; pokemon-colorscripts -n {1} --no-title; cat $POKEDATA/{1};" | + --bind=ctrl-n:preview:"printf '${indent}%s${indent} %s\n' 'Press space to hear entry' 'ctrl+space to stop'; pokemon-colorscripts -n {1} --no-title; cat $POKEDATA/{1};" | parallel pokemon-colorscripts --no-title -n {} "&&" cat "$POKEDATA/{}" } @@ -59,7 +62,7 @@ quick_view() { ### Update Pokemon stats file set update_pokeData() { printf "\n\t\t%s\n\t%s\n\n" "WARNING!!!" "This WILL take a long time" - pokemon-colorscripts -l | sort | parallel --progress --bar --color --retry-failed -j "${1:-200%}" pokeInfo {} ">" "$POKEDATA/{}" 2>&1 + ./jqPokeTest } if ! (( $# )); then