diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2017-05-25 16:19:31 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2017-05-25 17:28:30 -0400 |
commit | 1b0f24c5ba3d319145ac70e09e37d547a72390b4 (patch) | |
tree | f93bf9d1d9512ad3c1691add42c885311f0cbe24 /src | |
parent | fb9cba77198da23c2eb6fbede2d53851af9576ac (diff) |
libreblacklist: reformat some loops to be more readable
Diffstat (limited to 'src')
-rwxr-xr-x | src/lib/libreblacklist | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/src/lib/libreblacklist b/src/lib/libreblacklist index d6fc7f3..595b22d 100755 --- a/src/lib/libreblacklist +++ b/src/lib/libreblacklist @@ -46,22 +46,26 @@ else print "Tool for working with the nonfree software blacklist" echo print "Commands:" - usage-outside | while read -r sec; do sec="$(usage-inside "$sec")" - cmd=$(<<<"$sec" sed -n '$s/^blacklist-//p') - desc="$(_ "$(sed -n 2p <<<"$sec")")" - flag "$cmd" "${desc//blacklist-/${0##*/} }" - done + while read -r sec; do + sec="$(usage-inside "$sec")" + + cmd=$(<<<"$sec" sed -n '$s/^blacklist-//p') + desc="$(_ "$(sed -n 2p <<<"$sec")")" + flag "$cmd" "${desc//blacklist-/${0##*/} }" + done < <(usage-outside) else - usage-outside | while read -r sec; do sec="$(usage-inside "$sec")" - cmd=$(<<<"$sec" sed -n '$s/^blacklist-//p') - if [[ "$cmd" == "$1" ]]; then - <<<"$sec" sed '$d' | - while read -r line; do print "$line"; done | - sed "s/blacklist-/${0##*/} /g" | - fmt -us - return 0 - fi - done + while read -r sec; do + sec="$(usage-inside "$sec")" + + cmd=$(<<<"$sec" sed -n '$s/^blacklist-//p') + if [[ "$cmd" == "$1" ]]; then + <<<"$sec" sed '$d' | + while read -r line; do print "$line"; done | + sed "s/blacklist-/${0##*/} /g" | + fmt -us + return 0 + fi + done < <(usage-outside) fi } |