]> www.infradead.org Git - users/dedekind/aiaiai.git/commitdiff
email-test-patchset: fix projects list generation
authorArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
Tue, 4 Feb 2014 15:17:49 +0000 (17:17 +0200)
committerArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
Tue, 4 Feb 2014 17:33:07 +0000 (19:33 +0200)
This patch fixes the 'list_projects()' which did not work because it was using
the 'cfg_descr' variable which was undefined. Indeed, this function is called
when the user either forgot to specify the project, or specified a non-existing
project.

This patch uses 'ini_config_get_or_die' to get project description. The whole
loop conctruct is cleaned up a bit too to make it more readable.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
email/aiaiai-email-test-patchset

index 305bd51624ce877ab64a918ba88b6b2ff8cd7c3b..12224d42aa4d482af116c5ad0da3a6cdb1bad8e8 100755 (executable)
@@ -75,8 +75,14 @@ list_projects()
 {
        local prj
 
-       LC_ALL=C sed -n -e "s/^\[prj_\(.*\)\]$/\1/p" "$cfgfile" | while read -r prj; do
-               printf "* %s\n" "$cfg_ownmail_local+$prj@$cfg_ownmail_domain: $cfg_descr"
+       LC_ALL=C sed -n -e "s/^\[prj_\(.*\)\]$/\1/p" "$cfgfile" | \
+           while read -r prj; do
+               # Get project description
+               local descr
+               ini_config_get_or_die descr "$cfgfile" "prj_$prj" "description"
+
+               local email="$cfg_ownmail_local+$prj@$cfg_ownmail_domain"
+               printf "* %s\n" "$prj ($email): $descr"
        done
 }