mbarkhau / bumpver

BumpVer: Automatic Versioning
https://github.com/mbarkhau/bumpver
MIT License
199 stars 36 forks source link

Show env will display blanks instead of expected 0 #224

Closed elfgirl closed 1 year ago

elfgirl commented 1 year ago

bumpver, version 2023.1127

config is as follows

[bumpver] current_version = "1.0.11+20231012.6336" version_pattern = "MAJOR.MINOR.PATCH[+YYYY0M0D.BUILD]"

command shows bumpver show -n --env ... MAJOR=1 MINOR= PATCH=11 ...

0 has a python truthiness of false, so a blank is reported src/bumpver/cli.py line 448 click.echo(f"{key.upper()}={val if val else ''}")

elfgirl commented 1 year ago

export $(bumpver show -n --env | xargs)

if [[ -z "$MAJOR" ]]; then export MAJOR=0; fi if [[ -z "$MINOR" ]]; then export MINOR=0; fi
if [[ -z "$PATCH" ]]; then export PATCH=0; fi

Is a workaround for those needing to slice and dice the version numbers themselves,

mbarkhau commented 1 year ago

Nice catch. Thanks.

mbarkhau commented 1 year ago

In order to not break any existing scripts, I've hidden the old flag -e/--env and added a new one --environ with the expected behaviour.

The new flag is available with 2023.1129