How to create precondition that only run if the binary not exists?
tasks:
migrate:
desc: Get golang-migrate
cmds:
- echo running wget bla bla
preconditions:
- sh: "test -z {{.MIGRATE_BIN}}"
msg: "found, ignoring"
vars:
MIGRATE_BIN:
sh: which migrate || true
or what kind of shell commands supported inside sh
? it it based on $?
return value or?
In normal shell I only need to do this:
MIGRATE_BIN=`which golang-migrate`
if [[ -z "$MIGRATE_BIN" ]]; then
echo "do wget bla bla"
fi
Ah should use status
instead of precondition
tasks:
migrate:
desc: Get golang-migrate
cmds:
- echo running wget bla bla
status:
- test -f {{.MIGRATE_BIN}}
vars:
MIGRATE_BIN:
sh: which migrate || true