Skip to content

Conversation

@fernandocollova
Copy link
Contributor

Hi again,

As I was trying to add this script to another step in my release process, I stumbled upon the fact that it wasn't so easy to get only the version that was just tagged, as the script's output is always printed on each run.

So, instead of capturing the output and extracting only the last line, I added a -q, --quiet option. It's implemented with minimal changes to the code, borrowing heavily from tldp.org and has some design choices that are worth mentioning:

  • I only suppressed output to stdout. Any messages echoed to stderr will continue to output.
  • In the case of -b and -p options, it still outputs the help if no input is provided.
  • In case a script returns an error that prevents tagging, it won't echo anything.

I'm specially hesitant about the second point, because although I want to keep the original behavior, I can totally see the situation in which you run something along the lines of git semver major --release "$(my_awesome_release_generator)" and after the awesome release generator returns nothing, the scripts outputs "something" instead of failing echoing nothing, which might incorrectly signal the code was actually tagged.

Also, a not about the implementation: I wasn't able to find a lot of documentation, but as far as I can tell from this, this, and this links, using /dev/null should be compatible with Cygwin and MinGW. And also again, I remember MacOS had a /dev/null so I guess it should also work with it.

So, if you find this feature useful, let me know of any problems of improvements, and thanks in advance for reviewing.

@fernandocollova
Copy link
Contributor Author

Seeing the diff, I just realized I branched from the wrong commit, as I thought I made this MR when I didn't :/

I amended the lines differing from master, so this code is what I actually want to submit, but if you see it necessary, I'll close this MR and open a new one branching from the correct place.

Thanks, Fernando

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant