ddollar / forego

Foreman in Go
1.43k stars 175 forks source link

Add NO_COLOR, inject version tag, and more #124

Open sehrope opened 4 years ago

sehrope commented 4 years ago

This PR is a rebased version of #122 with a couple more commits added by me. That original PR improves the error handling and adds automatic disabling of color output based on whether stdout is a terminal.

This PR expands on that with a few more commits to:

  1. Add injecting a VERSION Makefile variable so you can include the date / commit in the resulting build. Defaults to current value of "dev":
$ make VERSION="$(date --utc +%Y%m%d-%H%M%S)-$(git show-ref -s -- HEAD)" build
...
$ forego version
20200605-120321-0bdbf9b27cf9da13e246ff1ba90ab5961f4be849
  1. Checks for a NO_COLOR env variable and, if defined, disables color output regardless of whether we're running in a terminal (per https://no-color.org/)
$ NO_COLOR=1 forego start
...
  1. Optimize things a bit by only creating the "left" outlet formatter once. Previously it was being generated for ever line of output but the format itself never changes so it's wasted cycles.
oliver-hohn commented 4 years ago

Hi there 👋

There seems to be quite a lot of requests for supporting a "no color" output (including from me 😄), I think merging this in would be a "quick win".

@ddollar Could this be reviewed? Apologies, if you're not maintaining this repo anymore, but if that is the case could you point me to who is maintaining the repo?

Thank you.

yb66 commented 4 years ago

@sehrope, nice work. I've closed my pull request, hopefully someone will merge this in soon.

Regards, iain

sehrope commented 3 years ago

@yb66 @oliver-hohn

As there hasn't been any activity in this repo in a while, I'm publishing the changes in my fork at: https://github.com/sehrope/forego

It includes everything from this PR as well as some updates to the go version, changes to use go modules, GitHub Actions for CI, and has pre-built binaries as GitHub releases for Linux, OSX, and Windows (https://github.com/sehrope/forego/releases).

If things every open up again here we can merge back.