Open
Conversation
Here we're updating the team action to make a few improvements. * Allow multiple output formats for `list`, `info`, `update`. * Refactor positional argument for ID to flag `--team`. * Add examples to help output. * Change `enforce_sso` to `Bool` from `Bool?`. (API change) * Update/add new tests.
ngaumont
requested changes
Jan 18, 2023
Contributor
ngaumont
left a comment
There was a problem hiding this comment.
Nice improvements.
My comments are mainly to add a default ouput method to avoid duplication.
Comment on lines
+102
to
+103
| def validate | ||
| end |
Contributor
There was a problem hiding this comment.
Suggested change
| def validate | |
| end | |
| def validate | |
| check_required_args do |missing| | |
| missing << "team" unless team_id | |
| end |
|
|
||
| private def output_team_details(t : CB::Client::Team) | ||
| bool_setter show_header, true | ||
|
|
Contributor
There was a problem hiding this comment.
I think this should be available as a teamAction method to avoid duplicate:
Suggested change
| private def output_team(team: CB::Client::Team) | |
| case @format | |
| when Format::Default, Format::List | |
| output_list team | |
| when Format::JSON | |
| output_json team | |
| when Format::Table | |
| output_table team | |
| else | |
| raise_invalid_format @format | |
| end | |
| end |
Comment on lines
+78
to
+81
| when Format::JSON | ||
| output_json team | ||
| else | ||
| raise_invalid_format @format |
Contributor
There was a problem hiding this comment.
This will also allow list and table format
Suggested change
| when Format::JSON | |
| output_json team | |
| else | |
| raise_invalid_format @format | |
| else | |
| output(team) |
Comment on lines
51
to
+118
| case @format | ||
| when Format::Default, Format::List | ||
| output_team_details(team) | ||
| output_list team | ||
| when Format::JSON | ||
| output_json team | ||
| when Format::Table | ||
| output_json team | ||
| else | ||
| raise_invalid_format @format |
Contributor
There was a problem hiding this comment.
There is a typo in the when Format::Table it should use output_table
But it could also be written:
output(team)
Comment on lines
+153
to
+162
| case @format | ||
| when Format::Default, Format::List | ||
| output_list team | ||
| when Format::JSON | ||
| output_json team | ||
| when Format::Table | ||
| output_table team | ||
| else | ||
| raise_invalid_format @format | ||
| end |
Contributor
There was a problem hiding this comment.
Suggested change
| case @format | |
| when Format::Default, Format::List | |
| output_list team | |
| when Format::JSON | |
| output_json team | |
| when Format::Table | |
| output_table team | |
| else | |
| raise_invalid_format @format | |
| end | |
| output(team) |
fe69c4e to
8805c40
Compare
6391d23 to
5ca9fcf
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Here we're updating the team action to make a few improvements.
list,info,update.--team.enforce_ssotoBoolfromBool?. (API change)