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

gh cs - Choose the only codespace if only one exists #9039

Open
alondahari opened this issue May 2, 2024 · 2 comments
Open

gh cs - Choose the only codespace if only one exists #9039

alondahari opened this issue May 2, 2024 · 2 comments
Labels
codespaces enhancement a request to improve CLI gh-codespace relating to the gh codespace command

Comments

@alondahari
Copy link

Describe the feature or problem you’d like to solve

In the context of the gh cs subcommand, if I only have one active codespace it would be nice if it would be selected automatically. This is for any subcommand that requires choosing an existing codespace from a list, such as gh cs ssh.

I usually only have one codespace and I want to skip selecting it when I’m connecting.

Proposed solution

Potentially add it as a flag if we don't want to change the existing, skip the codespace selection step if only one exists and the command requires selecting an existing codespace.

This seems pretty trivial, and you could easily alias a workaround, but that would be a nice native behaviour imo. It could also help with scripting.

@alondahari alondahari added the enhancement a request to improve CLI label May 2, 2024
@cliAutomation cliAutomation added the needs-triage needs to be reviewed label May 2, 2024
@andyfeller andyfeller added codespaces gh-codespace relating to the gh codespace command labels May 7, 2024
@andyfeller
Copy link
Contributor

@alondahari : Thanks for opening this suggestion!

I could see this being a flag or even a configuration option you toggle, but I defer to our Codespaces team for consideration here.

cc: @dmgardiner25 @cmbrose

@andyfeller andyfeller removed the needs-triage needs to be reviewed label May 7, 2024
@cmbrose
Copy link
Contributor

cmbrose commented May 7, 2024

Thanks for the suggestion!

We actually started moving in this direction a while back when we refactored to the CodespaceSelecter helper. In there we have some logic that if you specify the repo name (-R/--repo) for (most) commands then we'll skip the prompt if there is only one codespace.

I think the reason that we stopped short of doing that in all cases was a bit of back compat in the experience and not being too magical. That said, I like the idea of an --auto-pick (hopefully we can find a better name 😅 ) flag which would force this behavior. That can easily be added to the CodespaceSelector flags.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
codespaces enhancement a request to improve CLI gh-codespace relating to the gh codespace command
Projects
None yet
Development

No branches or pull requests

4 participants