瀏覽代碼

Move colon delimiting to generator

Alois Mahdal 9 年之前
父節點
當前提交
ad3a74047a
共有 1 個文件被更改,包括 14 次插入6 次删除
  1. 14
    6
      src/bin/saturnin.skel

+ 14
- 6
src/bin/saturnin.skel 查看文件

@@ -15,7 +15,7 @@ inigrep_modules() {
15 15
       | LC_ALL=C sort
16 16
 }
17 17
 
18
-inigrep_paths() {
18
+inigrep_mkpath() {
19 19
     #
20 20
     # Assemble list of config paths for FFOO_INIGREP_PATH (path per line)
21 21
     #
@@ -23,20 +23,28 @@ inigrep_paths() {
23 23
     local user      # user's generic config
24 24
     local lcal      # local admin provided config
25 25
     local distd     # distribution-provided config (always modular)
26
+    local path      # one path item
26 27
     userd="__SATURNIN_CONFIG_USER__/ini.d"
27 28
     user="__SATURNIN_CONFIG_USER__"
28 29
     lcal="__SATURNIN_CONFIG_LOCAL__"
29 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 44
 export FFOO_INIGREP_PATH FFOO_PATH FFOO_PRETTY_USAGE \
37 45
        SATURNIN_VERSION SATURNIN_CACHE_HOME
38 46
 
39
-FFOO_INIGREP_PATH="$(inigrep_paths | tr '\n' :)"
47
+FFOO_INIGREP_PATH="$(inigrep_mkpath)"
40 48
 FFOO_PATH="__SATURNIN_FFOO_DIR__"
41 49
 FFOO_PRETTY_USAGE="subcommand"
42 50
 SATURNIN_CACHE_HOME="__SATURNIN_CACHE_HOME__"