Author: Adam <git@apiote.xyz>
fix listing items in toy
get.sh | 8 ++++++-- templates/toy.html | 5 ++++-
diff --git a/get.sh b/get.sh index 57fcd7293decb1528a55de49a37b27b09f032e0d..f18b89dbddb826137ce998d82b05581eb3850f63 100644 --- a/get.sh +++ b/get.sh @@ -16,10 +16,14 @@ then printf "n;" else printf "0;" - items=$(find "toys/$toy" -mindepth 1 -maxdepth 1 -type d | sed "s|toys/$toy/||") + items=$(find "toys/$toy" -mindepth 1 -maxdepth 1 -type d | grep -E '[0-9]+' | sed "s|toys/$toy/||" | sort -n) + if [ -z "$items" ] + then + return + fi echo "$items" | while read -r item do - status=$(show_item "$toy" 'latest' | head -n1 | cut -d ';' -f1) + status=$(show_item "$toy" "$item" | head -n1 | cut -d ';' -f1) printf '%s,%s ' "$status" "$item" done fi diff --git a/templates/toy.html b/templates/toy.html index 82ea88d26598756c607e2571468ae17e527e9c2d..f99e842eab8cd693c94f1b591853a51999d1279b 100644 --- a/templates/toy.html +++ b/templates/toy.html @@ -19,13 +19,16 @@ if [ "$(echo "$content" | tr -d ' ' | sed 's/n,//')" = '' ] then printf '\t\tHave not run yet\n' else - echo "$content" | while read -r item + for item in $content do status=$(echo "$item" | cut -d ',' -f1) name=$(echo "$item" | cut -d ',' -f2) if [ "$status" = '0' ] then printf '\t\tOK ' + elif [ "$status" = 'r' ] + then + printf '\t\tRUN ' else printf '\t\tERR ' fi