浏览代码

Add mkpretty.sh meta-library

Purpose of this library is to import the actual pretty-printing library
based on FFOO_MKPRETTY value or fall back to mkpretty_plain.
Alois Mahdal 10 年前
父节点
当前提交
5732eeec55
共有 1 个文件被更改,包括 27 次插入0 次删除
  1. 27
    0
      include/mkpretty.sh

+ 27
- 0
include/mkpretty.sh 查看文件

@@ -0,0 +1,27 @@
1
+#!/bin/bash
2
+
3
+#
4
+# Name of prerry-printer module
5
+#
6
+# Friendly name of module used for decorating output.  For
7
+# example, if the value is NAME, a mkpretty_NAME module must
8
+# exist and be importable.  Otherwise mkpretty will fall back
9
+# to plain, which is also the default value.
10
+#
11
+FFOO_MKPRETTY=${FFOO_MKPRETTY:-plain}
12
+
13
+
14
+__ffoo_mkpretty__init() {
15
+    #
16
+    # Import proper submodule
17
+    #
18
+    if ffoo try_import mkpretty_${FFOO_MKPRETTY};
19
+    then
20
+        ffoo import mkpretty_${FFOO_MKPRETTY}
21
+        return 0
22
+    else
23
+        warn "falling back to mkpretty_plain"
24
+        FFOO_MKPRETTY=plain
25
+        ffoo import mkpretty_${FFOO_MKPRETTY}
26
+    fi
27
+}