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

Replace Version Command with Cobra #148

Merged
merged 1 commit into from
Sep 21, 2023
Merged

Replace Version Command with Cobra #148

merged 1 commit into from
Sep 21, 2023

Conversation

rustydb
Copy link
Contributor

@rustydb rustydb commented Sep 21, 2023

Summary and Scope

Minify the code for printing the version by leveraging Cobra's built-in version parameter.

This is a small contribution, it served more as an exercise for myself to get the repo cloned and to start playing with it.

Testing

When cani is built on a tag:

[545]rusty@C02F43JEMD6P:~/gitstuffs/cray-shasta/cani> ./bin/cani --version
cani version 1.2.1

When cani is built on a commit after a tag.

[548]rusty@C02F43JEMD6P:~/gitstuffs/cray-shasta/cani> ./bin/cani --version
cani version 0.2.0~22~g5ed008b

When cani is built with uncommitted changes in the repository folder.

[538]rusty@C02F43JEMD6P:~/gitstuffs/cray-shasta/cani> ./bin/cani --version
cani version 0.2.0~22~gb56005a-dirty-2023-09-21T18:04:17Z

Risks and Mitigations

@jacobsalmela
Copy link
Collaborator

Slick. Just need to update those fixtures with the new output

@jacobsalmela
Copy link
Collaborator

Oh looks like you accidentally removed some files, too like our fancy logo.

@rustydb
Copy link
Contributor Author

rustydb commented Sep 21, 2023

Oh looks like you accidentally removed some files, too like our fancy logo.

It's not removed, it's shrunk. I shrunk it from 44kb to 16kb.

@jacobsalmela
Copy link
Collaborator

I see now. I don't think we need that as part of this PR though?

@rustydb
Copy link
Contributor Author

rustydb commented Sep 21, 2023

I see now. I don't think we need that as part of this PR though?

Sure, I had it as a separate commit and it got squashed in my rebase. Totally forgot about it when I made the PR.

@jacobsalmela
Copy link
Collaborator

I see, you can remove that version fixture since it is not a command any more. Then just update the shellspec test

Minify the code for printing the version by leveraging Cobra's built-in
`version` parameter.
@jacobsalmela jacobsalmela merged commit 10786c9 into main Sep 21, 2023
5 checks passed
@jacobsalmela jacobsalmela deleted the rusty branch September 21, 2023 20:04
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.

3 participants