-
Notifications
You must be signed in to change notification settings - Fork 55
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
Show scopes in apis
subcommands instead of count
#174
Conversation
…n terminal width, to show the scopes instead of the count. Use an ellipsis to shdenote the truncation. For the `apis show` subcommand, add an info to note that the full scopes can be viewed using `auth0 apis scopes list <api-id>`.
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 start, need to fix the table view and add the app id to the hint 💪🏻
… list may be truncated.
internal/display/apis.go
Outdated
@@ -110,3 +155,35 @@ func makeScopeView(scope *management.ResourceServerScope) *scopeView { | |||
Description: auth0.StringValue(scope.Description), | |||
} | |||
} | |||
|
|||
func truncateScopes(scopes []*management.ResourceServerScope) *string { |
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.
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 catch. Refactoring this now to bring the hint into the display logic instead of the cli logic.
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.
Almost there, let's not truncate the scopes that fit.
Thank you!
… truncation when the scopes are actually truncated. Don't truncate scopes that fit.
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.
Awesome! Thank you
Description
apis
subcommands that show scopes use a truncated list, based on terminal width, to show the scopes instead of the count. Use an ellipsis to denote the truncation.apis show
subcommand, add an info to note that the full scopes can be viewed usingauth0 apis scopes list <api-id>
.The truncation function handles conversion of the length of UTF strings to characters and truncates based on terminal width. If truncation is needed by other commands this can be refactored.
There is an off by one bug in the truncation but it errs on the side of truncating too much so won't affect display.
The padding for the left column of the table is fixed but could be refactored to use reflection to determine the max length of the
apiView
struct and apply the pre- and post-spacing in the display to account for future additions to the struct.References
Fixes #150
Checklist
master