pantheon-systems / autotag

Git repository version tagging tool
http://godoc.org/github.com/pantheon-systems/autotag
Apache License 2.0
192 stars 43 forks source link

Avoid writing error to Stdout #63

Closed dfreilich closed 2 years ago

dfreilich commented 2 years ago

In order to run this in a script, and account for a case where the tool doesn't handle (i.e. a repo without tags yet), I had hoped to pipe the output to Stderr and assign it a default value if it errors out, but that proved difficult, given that the error output was sent to Stdout. This should mitigate that.

For e.g., you should be able to do version=$(shell $(AUTOTAG) -e -n 2>/dev/null), "0.0.1") in a Makefile to generate a tag for all cases.

jburianek commented 2 years ago

Thanks @dfreilich! Merged.