Skip to content

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

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

cmbrose merged 24 commits into
trunkfrom
cmbrose/repo-filter

Conversation

@cmbrose

@cmbrose cmbrose commented Nov 28, 2022

Copy link
Copy Markdown
Member

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

cmbrose commented Nov 28, 2022

Copy link
Copy Markdown
Member Author

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

Comment thread pkg/cmd/codespace/ssh.go Outdated
Comment thread pkg/cmd/codespace/common.go Outdated
@cmbrose

cmbrose commented Jan 17, 2023

Copy link
Copy Markdown
Member Author

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

@samcoe samcoe left a comment •

Copy link
Copy Markdown
Contributor

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.

Comment thread pkg/cmd/codespace/common.go Outdated
Comment thread pkg/cmd/codespace/common.go Outdated
Comment thread pkg/cmd/codespace/common.go Outdated
Comment thread pkg/cmd/codespace/codespace_selector.go Outdated
Comment thread pkg/cmd/codespace/codespace_selector.go Outdated
Comment thread pkg/cmd/codespace/codespace_selector.go Outdated
Comment thread pkg/cmd/codespace/codespace_selector.go Outdated
Comment thread pkg/cmd/codespace/codespace_selector.go Outdated
Comment thread pkg/cmd/codespace/codespace_selector.go Outdated
Comment thread pkg/cmd/codespace/codespace_selector.go Outdated
Comment thread pkg/cmd/codespace/edit.go
@cmbrose

cmbrose commented Feb 21, 2023

Copy link
Copy Markdown
Member Author

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

@samcoe samcoe left a comment

Copy link
Copy Markdown
Contributor

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.

Comment thread pkg/cmd/codespace/codespace_selector.go

@jungaretti jungaretti left a comment

Copy link
Copy Markdown
Contributor

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