Compare commits
No commits in common. "39323d772afbfaec1f77d38820dd7b12ef38b659" and "d08e07fd72c2dfd5d4e94db11fe81189868cf397" have entirely different histories.
39323d772a
...
d08e07fd72
1 changed files with 4 additions and 3 deletions
7
wled
7
wled
|
@ -38,9 +38,10 @@ curl_cmd() {
|
|||
active_preset() {
|
||||
# Find number of active preset. API returns -1 if none is active, we return
|
||||
# an empty string.
|
||||
curl_cmd "http://$1/json" | \
|
||||
preset="$(curl_cmd "http://$1/json" | \
|
||||
# -1 will be a no-match.
|
||||
sed -n 's/.*"ps"[[:space:]]*:[[:space:]]*\(1\?[0-9]\).*/\1/p'
|
||||
sed -n 's/.*"ps"[[:space:]]*:[[:space:]]*\(1\?[0-9]\).*/\1/p')"
|
||||
printf '%u' "$preset"
|
||||
}
|
||||
|
||||
# Parse host argument.
|
||||
|
@ -102,7 +103,7 @@ case "$2" in
|
|||
# Extract number and name of every preset. Right-align numbers.
|
||||
# Drop everything else.
|
||||
sed --sandbox -n \
|
||||
'/^"\(1\?[0-9]\)"[[:space:]]*:.*"n"[[:space:]]*:[[:space:]]*"\([[:alnum:] _-]*\)".*$/{
|
||||
'/^"\(1\?[0-9]\)"[[:space:]]*:.*"n"[[:space:]]*:[[:space:]]*"\([[:print:]]*\)".*$/{
|
||||
s//\1: \2/
|
||||
s/^[0-9]:/ &/
|
||||
p
|
||||
|
|
Loading…
Add table
Reference in a new issue