summaryrefslogtreecommitdiff
path: root/actions.sh
blob: 49fa4e2e986a4b45e58acf5ca4e26cda121b0f98 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env sh

set -euC

test () {
    eval "prove -l ${1-} t/"
}

start () {
    script/jwebmail daemon
}

logrotate () {
    mode=${1:-development}
    mv -i "log/$mode.log" "log/${mode}_$(date --iso-8601=minutes).log"
}

linelength () {
    files=${1:-'README.md CHANGES LICENSE'}
    for file in $files
    do
        fold -s -w 85 "$file" | diff "$file" -
    done
}

follow () {
    mode=${1:-development}
    tail -f "log/$mode.log"
}

check_manifest () {
    perl -nE 'chomp; say unless -e' MANIFEST
}

cmd=$1
shift
if [ "$(command -v "$cmd")" = "$cmd" ]
then eval "$cmd" "$@"
else echo "unkown commad '$cmd'"; exit 1
fi