saml2aws
saml2aws copied to clipboard
feat: Route --version output to stdout
Currently, saml2aws --version prints the application version to stderr. This change modifies the behavior to print the version string to stdout instead while other logs and errors remain on stderr.
Reasoning:
Printing the version to stdout aligns better with common scripting practices and standard CLI tool behavior for version reporting. This makes it easier to capture the version string programmatically without needing stderr redirection (2>&1).
For example, users with bootstrapping or environment setup scripts that check dependency versions currently need to add special handling for saml2aws like
version = result.stdout.strip() if tool != "saml2aws" else result.stderr.strip()
or like
VERSION=$(saml2aws --version 2>&1)
Routing --version output to stdout removes this inconsistency.
https://github.com/Versent/saml2aws/issues/1432
:warning: Please install the to ensure uploads and comments are reliably processed by Codecov.
Codecov Report
Attention: Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.
Project coverage is 28.14%. Comparing base (
99d6fe4) to head (6e86cdc). Report is 155 commits behind head on master.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| cmd/saml2aws/main.go | 0.00% | 3 Missing :warning: |
:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@ Coverage Diff @@
## master #1431 +/- ##
===========================================
- Coverage 42.19% 28.14% -14.06%
===========================================
Files 54 70 +16
Lines 6456 12540 +6084
===========================================
+ Hits 2724 3529 +805
- Misses 3283 8535 +5252
- Partials 449 476 +27
| Flag | Coverage Δ | |
|---|---|---|
| unittests | 28.14% <0.00%> (-14.06%) |
:arrow_down: |
Flags with carried forward coverage won't be shown. Click here to find out more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
Instead of reimplementing the
Version()function it looks like we can set the usage and version output to write withos.stdoutusing.UsageWriter().So we keep the
.Version(and we set the.UsageWriter(. I've checked, but we should verify, this should not interfere with error messages caused by incorrect commands from going to stderr because that is handled byfatalUsage().https://github.com/alecthomas/kingpin/blob/64d23c54e3e2a385ce12757939bed9c632d1693c/app.go#L146
Thanks for the review. That's way cleaner.
I verified that errors are sent to stderr by running this: $GOPATH/bin/saml2aws invalid 1>out.txt 2>err.txt