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

Team action improvements. #94

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

abrightwell
Copy link
Member

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.

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.
Copy link
Contributor

@ngaumont ngaumont left a comment

Choose a reason for hiding this comment

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

Nice improvements.
My comments are mainly to add a default ouput method to avoid duplication.

Comment on lines +102 to +103
def validate
end
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
def validate
end
def validate
check_required_args do |missing|
missing << "team" unless team_id
end

@@ -5,13 +5,53 @@ abstract class CB::TeamAction < CB::APIAction

format_setter format

private def output_team_details(t : CB::Client::Team)
bool_setter show_header, true

Copy link
Contributor

Choose a reason for hiding this comment

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

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
Copy link
Contributor

Choose a reason for hiding this comment

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

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 110 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
Copy link
Contributor

Choose a reason for hiding this comment

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

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
Copy link
Contributor

Choose a reason for hiding this comment

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

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)

@abrightwell abrightwell requested a review from a team as a code owner January 23, 2024 13:24
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