summaryrefslogtreecommitdiff
path: root/tests/_setup_alias
blob: 0d5c302a1e1b5ddebe031fbda0892b194449879b (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
outfile=$(mktemp)

error() {
    echo "$1"
    echo "sleeping 3"
    sleep 3
    exit 255
}

[ -z "$calendar_cli" ] && [ -x ./calendar-cli.py ] && calendar_cli=./calendar-cli.py
[ -z "$calendar_cli" ] && [ -x ../calendar-cli.py ] && calendar_cli=../calendar-cli.py
[ -z "$calendar_cli" ] && error "couldn't find ./calendar_cli.py nor ../calendar_cli.py"

[ -z "$kal" ] && [ -x ./cal.py ] && kal=./cal.py
[ -z "$kal" ] && [ -x ../cal.py ] && kal=../cal.py
[ -z "$kal" ] && error "couldn't find ./cal.py nor ../cal.py"

calendar_cli() {
    echo "    $calendar_cli $@"
    output=$($calendar_cli "$@" | tee $outfile)
    [ -z "$output" ] || [ -z "$QUIET" ] || echo $output
}

kal() {
    echo "    $kal $@"
    output=$($kal "$@"  | tee $outfile)
    [ -z "$output" ] || [ -z "$QUIET" ] || echo $output
}