Browse Source

Move colon delimiting to generator

Alois Mahdal 9 years ago
parent
commit
ad3a74047a
1 changed files with 14 additions and 6 deletions
  1. 14
    6
      src/bin/saturnin.skel

+ 14
- 6
src/bin/saturnin.skel View File

15
       | LC_ALL=C sort
15
       | LC_ALL=C sort
16
 }
16
 }
17
 
17
 
18
-inigrep_paths() {
18
+inigrep_mkpath() {
19
     #
19
     #
20
     # Assemble list of config paths for FFOO_INIGREP_PATH (path per line)
20
     # Assemble list of config paths for FFOO_INIGREP_PATH (path per line)
21
     #
21
     #
23
     local user      # user's generic config
23
     local user      # user's generic config
24
     local lcal      # local admin provided config
24
     local lcal      # local admin provided config
25
     local distd     # distribution-provided config (always modular)
25
     local distd     # distribution-provided config (always modular)
26
+    local path      # one path item
26
     userd="__SATURNIN_CONFIG_USER__/ini.d"
27
     userd="__SATURNIN_CONFIG_USER__/ini.d"
27
     user="__SATURNIN_CONFIG_USER__"
28
     user="__SATURNIN_CONFIG_USER__"
28
     lcal="__SATURNIN_CONFIG_LOCAL__"
29
     lcal="__SATURNIN_CONFIG_LOCAL__"
29
     distd="__SATURNIN_SHARE__/ini.d"
30
     distd="__SATURNIN_SHARE__/ini.d"
30
-    inigrep_modules "$userd"
31
-    echo "$user"
32
-    echo "$lcal"
33
-    inigrep_modules "$distd"
31
+    {
32
+        inigrep_modules "$userd"
33
+        echo "$user"
34
+        echo "$lcal"
35
+        inigrep_modules "$distd"
36
+    } \
37
+      | while read path;
38
+        do
39
+            test -z "$path" && continue
40
+            echo -n "$path:"
41
+        done
34
 }
42
 }
35
 
43
 
36
 export FFOO_INIGREP_PATH FFOO_PATH FFOO_PRETTY_USAGE \
44
 export FFOO_INIGREP_PATH FFOO_PATH FFOO_PRETTY_USAGE \
37
        SATURNIN_VERSION SATURNIN_CACHE_HOME
45
        SATURNIN_VERSION SATURNIN_CACHE_HOME
38
 
46
 
39
-FFOO_INIGREP_PATH="$(inigrep_paths | tr '\n' :)"
47
+FFOO_INIGREP_PATH="$(inigrep_mkpath)"
40
 FFOO_PATH="__SATURNIN_FFOO_DIR__"
48
 FFOO_PATH="__SATURNIN_FFOO_DIR__"
41
 FFOO_PRETTY_USAGE="subcommand"
49
 FFOO_PRETTY_USAGE="subcommand"
42
 SATURNIN_CACHE_HOME="__SATURNIN_CACHE_HOME__"
50
 SATURNIN_CACHE_HOME="__SATURNIN_CACHE_HOME__"