gsu: Print help text on prefs command.
authorAndre Noll <maan@systemlinux.org>
Tue, 2 Mar 2010 14:56:50 +0000 (15:56 +0100)
committerAndre Noll <maan@tuebingen.mpg.de>
Fri, 29 Aug 2014 19:36:07 +0000 (21:36 +0200)
This uses another nice bashism I recently learned.

funcs/gsu

index 043676c..add1be4 100644 (file)
--- a/funcs/gsu
+++ b/funcs/gsu
@@ -163,6 +163,7 @@ com_prefs()
                        printf " [$default_value]"
                fi
                echo
+               [[ -n "$help_text" ]] && sed -e '/^[    ]*$/d; s/^[     ]*/#    /g' <<< "$help_text"
                printf "$name=$val"
                [[ "$val" == "$default_value" ]] && printf " # default"
                echo