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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement porter credential show command #401
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Just 2 refactorings that are going to be very helpful for our testing going forward. If you prefer to do it follow-ons, that's fine too.
pkg/porter/credentials.go
Outdated
return errors.Wrap(err, "unable to determine credentials directory") | ||
} | ||
|
||
credSet := &credentials.CredentialSet{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you break this up into 2 functions: GetCredential and ShowCredential? It makes it easier for testing and automating porter that way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Argh, you'd think I would've learned this best practice from the last credentials list PR! Thank you for the reminder (again). Updated.
pkg/porter/credentials.go
Outdated
// Iterate through all CredentialStrategies to build up our data set | ||
for _, cs := range credSet.Credentials { | ||
// Build a reflected Source of type reflectedStruct, for use below | ||
reflectedSource := reflectedStruct{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest making an exported function that accepts Source
and returns the string representing the the source type. It will be easier to read and I bet others will want to use it too. This looks like it was hard to figure out! 馃憤
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call; now broken out into exported function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@vdice let's get the changes from @carolynvs in a follow up, i merged this for the goodness |
@jeremyrickard @carolynvs I think requested changes were all addressed prior to merge... let me know if not. |
porter credential show
commandSample:
Question(s) for the reviewer:
printer
pkg to use the tablewriter enlisted for credential show -- and therefore, apply same table formatting/config for all table printing -- or just keep it for this particular command?reflect
craziness used for determining credential source type a sign I wildly missed an easier route?! 馃槄