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

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

Merged
merged 24 commits into from Feb 22, 2023
Merged

Conversation

cmbrose
Copy link
Contributor

@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
@cliAutomation cliAutomation added this to Needs review 🤔 in The GitHub CLI Nov 28, 2022
@cmbrose
Copy link
Contributor 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 😄

pkg/cmd/codespace/ssh.go Outdated Show resolved Hide resolved
pkg/cmd/codespace/common.go Outdated Show resolved Hide resolved
@cmbrose
Copy link
Contributor 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.

pkg/cmd/codespace/common.go Outdated Show resolved Hide resolved
pkg/cmd/codespace/common.go Outdated Show resolved Hide resolved
pkg/cmd/codespace/common.go Outdated Show resolved Hide resolved
pkg/cmd/codespace/codespace_selector.go Outdated Show resolved Hide resolved
pkg/cmd/codespace/codespace_selector.go Outdated Show resolved Hide resolved
pkg/cmd/codespace/codespace_selector.go Outdated Show resolved Hide resolved
pkg/cmd/codespace/codespace_selector.go Outdated Show resolved Hide resolved
pkg/cmd/codespace/codespace_selector.go Outdated Show resolved Hide resolved
pkg/cmd/codespace/codespace_selector.go Outdated Show resolved Hide resolved
pkg/cmd/codespace/edit.go Outdated Show resolved Hide resolved
@cmbrose
Copy link
Contributor 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.

pkg/cmd/codespace/codespace_selector.go Show resolved Hide resolved
The GitHub CLI automation moved this from Needs review 🤔 to Needs to be merged 🎉 Feb 22, 2023
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
The GitHub CLI automation moved this from Needs to be merged 🎉 to Pending Release 🥚 Feb 22, 2023
@cmbrose cmbrose deleted the cmbrose/repo-filter branch February 22, 2023 23:16
@github-actions github-actions bot moved this from Pending Release 🥚 to Done 💤 in The GitHub CLI Mar 8, 2023
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
No open projects
The GitHub CLI
  
Done 💤
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