Can't get build_flags to work with TRAVIS_TAG

I have the following environment specified in my But pio run -e nodemcuv2_ci keeps giving me error:

NoSectionError: No section: ‘TRAVIS_TAG:"0’

platform = espressif8266
board = nodemcuv2
framework = arduino
build_flags = !echo '-DBUILD_TAG='${TRAVIS_TAG:-"0.0.0"}

I copied this from an example somewhere.

I got it working by doing the following:

build_flags = !(test -z $TRAVIS_TAG && echo ‘${common.version}’) || echo ‘-DBUILD_TAG=’$TRAVIS_TAG