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.
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.