Skip to content

Conversation

@jfatta
Copy link

@jfatta jfatta commented Jan 25, 2021

image

with --format=json
image

@jfatta jfatta requested a review from cyx January 25, 2021 21:00
Comment on lines +125 to +130
func apiCallbacksFor(s []string) []interface{} {
res := make([]interface{}, len(s))
for i, v := range s {
res[i] = v
}
return res
Copy link
Author

Choose a reason for hiding this comment

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

I wonder if there is a 1-liner to convert from []string to []interface{} 🤔

Copy link
Contributor

Choose a reason for hiding this comment

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

Nah there's none :) It's the reason the generics troll gets fueled :)

func (v *clientView) AsTableHeader() []string {
if v.revealSecret {
return []string{"Name", "Type", "ClientID", "Client Secret"}
return []string{"Name", "Type", "ClientID", "Client Secret", "Callbacks"}
Copy link
Author

Choose a reason for hiding this comment

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

a refactor here regarding how the columns are included/excluded will be needed at some point (probably not for the PoC)

func (v *clientView) AsTableRow() []string {
if v.revealSecret {
return []string{v.Name, v.Type, ansi.Faint(v.ClientID), ansi.Italic(v.ClientSecret)}
return []string{
Copy link
Author

Choose a reason for hiding this comment

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

same here, potential combinations are going to make this hard to maintain

Comment on lines +109 to +115
func callbacksFor(s []interface{}) []string {
res := make([]string, len(s))
for i, v := range s {
res[i] = fmt.Sprintf("%s", v)
}
return res
}
Copy link
Author

Choose a reason for hiding this comment

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

is there a simpler way to convert from []interface{} -> []string ?

@cyx cyx merged commit 47d6158 into main Jan 25, 2021
@cyx cyx deleted the client-create-improvements branch January 25, 2021 21:25
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