|
@@ -24,6 +24,16 @@ usage() {
|
24
|
24
|
"are also available in .imapdomo/common.lua"
|
25
|
25
|
}
|
26
|
26
|
|
|
27
|
+bug() {
|
|
28
|
+ #
|
|
29
|
+ # Die because of bug
|
|
30
|
+ #
|
|
31
|
+ local msg=$1
|
|
32
|
+ local self
|
|
33
|
+ self=$(basename "$0")
|
|
34
|
+ die "bug in $self (__MKIT_PROJ_VERSION__): $msg"
|
|
35
|
+}
|
|
36
|
+
|
27
|
37
|
mkcmd() {
|
28
|
38
|
#
|
29
|
39
|
# Compose imapfilter command
|
|
@@ -86,12 +96,12 @@ main() {
|
86
|
96
|
|| dle "no handler for action: $Action.lua in $IMAPDOMO_HOME/handlers"
|
87
|
97
|
cmd=$(mkcmd)
|
88
|
98
|
debug -v cmd
|
89
|
|
- bash -n <<<"$cmd" || die
|
|
99
|
+ bash -n <<<"$cmd" || bug "bad syntax of cmd: '$cmd'"
|
90
|
100
|
if test -n "$CdTo";
|
91
|
101
|
then
|
92
|
|
- cd "$CdTo" || die
|
|
102
|
+ cd "$CdTo" || die "cannot chdir to: $CdTo"
|
93
|
103
|
fi
|
94
|
|
- mkdir -p "$HeaderDir" || die
|
|
104
|
+ mkdir -p "$HeaderDir" || die "cannot create header directory: $HeaderDir"
|
95
|
105
|
eval "$cmd"
|
96
|
106
|
}
|
97
|
107
|
|