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

feat: include Callbacks on clients create and list #25

Merged
merged 2 commits into from
Jan 25, 2021

Conversation

jfatta
Copy link
Contributor

@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
Contributor 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 :)

revealSecret bool
}

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
Contributor 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
Contributor 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
Contributor 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 ?

internal/display/clients.go Outdated Show resolved Hide resolved
@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.

2 participants