diff --git a/wled b/wled index dd31534..16ec609 100755 --- a/wled +++ b/wled @@ -98,8 +98,8 @@ case "$2" in printf "loading ...\r" active_ps=$(active_preset "$wled_host") curl_cmd "http://$wled_host/presets.json" | \ - # Split into lines - one line per preset. Append final newline. - sed --sandbox 's/"\(1\?[0-9]\)"[[:space:]]*:/\n&/g; $a\ ' | \ + # Split into lines - one line per preset. + sed --sandbox 's/"1\?[0-9]"[[:space:]]*:/\n&/g' | \ # Prepend description, extract number and name of every preset, # match active preset, right-align numbers and finally select # lines to print. @@ -108,7 +108,9 @@ case "$2" in -e 's/^"\(1\?[0-9]\)"[[:space:]]*:.*"n"[[:space:]]*:[[:space:]]*"\([[:print:]]*\)".*$/\1: \2/' \ -e "s/^$active_ps:.*/& */" \ -e 's/^[0-9]:/ &/' \ - -e '/^[1 ]\?[0-9]: [[:print:]]\+/p' + -e '/^[1 ]\?[0-9]: [[:print:]]\+/p' | \ + # Sort. + sort -b -n exit $? ;; dump) # Dump JSON response from API.