]> www.infradead.org Git - users/dedekind/aiaiai.git/commitdiff
aiaiai: split sed project listing from list_projects
authorJacob Keller <jacob.e.keller@intel.com>
Thu, 27 Mar 2014 18:40:04 +0000 (11:40 -0700)
committerArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
Mon, 31 Mar 2014 08:21:02 +0000 (11:21 +0300)
In order to allow other places such as hooks to list the projects,
seperate out the sed script into its own function. This enables less
code duplication if another script wants to list all projects in a
cfgfile.

Artem: re-named the function for a bit better readability.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
email/aiaiai-email-sh-functions
email/aiaiai-email-test-patchset

index 20e482603d7305501380c3daa0a9a8b84d7763ac..b840f4eb1d4ccddc64203927018300682c083fcc 100644 (file)
@@ -134,6 +134,14 @@ ini_config_get_or_die()
        eval "$var=\"\$result\""
 }
 
+# Get the list of projects from config file "$1".
+get_cfgfile_projects_list()
+{
+       local cfgfile="$1"
+
+       LC_ALL=C sed -n -e "s/^\[prj_\(.*\)\]$/\1/p" "$cfgfile"
+}
+
 # Parse the "global" section of the config file. The result is a set of
 # per-option variables and their values are exactly as in the configuration
 # file:
index c5b5a3d78b596761c6a09ceafc55d58c753e911f..069289418198c7536b076f32b75f3307938cb978 100755 (executable)
@@ -68,8 +68,8 @@ list_projects()
 {
        local prj
 
-       LC_ALL=C sed -n -e "s/^\[prj_\(.*\)\]$/\1/p" "$cfgfile" | \
-           while read -r prj; do
+       get_cfgfile_projects_list "$cfgfile" | \
+       while read -r prj; do
                # Get project description
                local descr
                ini_config_get_or_die descr "$cfgfile" "prj_$prj" "description"