Skip to content

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.
@abrightwell abrightwell requested a review from ngaumont January 16, 2023 16:49
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


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 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
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
@abrightwell abrightwell force-pushed the main branch 2 times, most recently from fe69c4e to 8805c40 Compare April 3, 2025 23:20
@sfc-gh-abrightwell sfc-gh-abrightwell force-pushed the main branch 2 times, most recently from 6391d23 to 5ca9fcf Compare October 30, 2025 15:23
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