summaryrefslogtreecommitdiff
path: root/tests/_setup_alias
blob: 223467e83bb87ea03eba5efc5a7bbbc10ecd4764 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
set -o pipefail
outfile=$(mktemp)

error() {
    echo "FAILURE"
    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"

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