Skip to content

Add --repo filter to more gh codespaces commands#6669

Merged
cmbrose merged 24 commits intotrunkfrom
cmbrose/repo-filter
Feb 22, 2023
Merged

Add --repo filter to more gh codespaces commands#6669
cmbrose merged 24 commits intotrunkfrom
cmbrose/repo-filter

Conversation

@cmbrose
Copy link
Member

@cmbrose cmbrose commented Nov 28, 2022

Fixes: #6548

This adds a new -r/--repo argument to many codespace commands which don't already have it - code, stop, jupyter, ssh, etc. The argument pre-filters the codespace selection list and, if there is only a single codespace for the repo, automatically selects it.

See the example below which showcases:

  • Selecting a repo with multiple codespaces results in a prompt for only those codespaces
  • Selecting a repo with no codespaces results in a you have no codespaces error
  • Selecting a repo with a single codespace immediately opens it with no prompt

image

Note selecting both --codespace and --repo for these commands doesn't really make sense and so doing so results in an error:

image

@cmbrose cmbrose requested a review from a team as a code owner November 28, 2022 17:16
@cliAutomation cliAutomation added the external pull request originating outside of the CLI core team label Nov 28, 2022
@cmbrose
Copy link
Member Author

cmbrose commented Nov 28, 2022

Note that I do intend to add tests for this, but wanted to get sign off on the approach first 😄

@cmbrose
Copy link
Member Author

cmbrose commented Jan 17, 2023

cc @cli/code-reviewers - would appreciate feedback here when possible

Copy link
Contributor

@samcoe samcoe left a comment

Choose a reason for hiding this comment

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

@cmbrose Sorry for the delay in taking a look at this. I think what you have and the path you are taking works but in my comments I propose a different approach to the problem which I think would be easier to use as well as maintain in the future. Let me know if you have any questions about my comments.

@cmbrose
Copy link
Member Author

cmbrose commented Feb 21, 2023

@samcoe thanks for all the help on this review! It should be in a good state now for a last review 😄

Copy link
Contributor

@samcoe samcoe left a comment

Choose a reason for hiding this comment

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

@cmbrose This looks awesome, 🚢. Thanks for being patient with the review cycles.

Copy link
Contributor

@jungaretti jungaretti left a comment

Choose a reason for hiding this comment

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

This looks great! You used elegant patterns that we can use in other places too.

@cmbrose cmbrose merged commit 57c73e8 into trunk Feb 22, 2023
@cmbrose cmbrose deleted the cmbrose/repo-filter branch February 22, 2023 23:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external pull request originating outside of the CLI core team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gh cs commands accept a -r flag to filter to a specific repo

4 participants