Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --version flag to porter #1125

Merged
merged 2 commits into from
Jul 7, 2020
Merged

Conversation

carolynvs
Copy link
Member

What does this change

People never know if a CLI supports --version or a version command. So let's just support both so whatever they try will work. MAGIC!

What issue does it fix

Fighting muscle memory

Notes for the reviewer

Inspired by https://twitter.com/michellenoorali/status/1280517451550199808

Checklist

  • Unit Tests
  • Documentation
  • Schema (porter.yaml) - NA

People never know if a CLI supports --version or a version command. So
let's just support both so whatever they try will work. MAGIC!
@carolynvs
Copy link
Member Author

OMG I looooove testing cobra in unit tests. I just realize that you can set os.Args and was able to make the unit test so much easier to work with. 💯

Copy link
Member

@vdice vdice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

assert.Contains(t, out.String(), "porter v1.0.0 (abc123)")
})

t.Run("command", func(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: should we update this test name to differ from the other above?

@carolynvs carolynvs merged commit e644d00 into getporter:main Jul 7, 2020
@carolynvs carolynvs deleted the version-flag branch July 7, 2020 22:36
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.

2 participants