Skip to content

gh repo create doesn't acknowledge special characters in repo names #4558

@bchadwic

Description

@bchadwic

Describe the feature or problem you’d like to solve

On GitHub.com, the user receives a notification that mentions that any special characters will be converted to - when typing up a repo name. On the cli app, this is not the case which can lead to unexpected repo names. I ran into this yesterday on the cli app when I used "C#" in my new repo name.

PS C:\Users\Ben\Desktop\my-cool-C#-repo!> gh repo create
? Repository name (my-cool-C#-repo!)

? Repository name my-cool-C#-repo!
? Repository description Just a cool C# repo!

? Repository description Just a cool C# repo!
? Visibility Public
? This will add an "origin" git remote to your local repository. Continue? Yes
✓ Created repository bchadwic/my-cool-C--repo- on GitHub
✓ Added remote https://github.com/bchadwic/my-cool-C--repo-.git
PS C:\Users\Ben\Desktop\my-cool-C#-repo!>

Capture

As mentioned above ^
my-extraordinary-C#-repo! gets converted to my-extraordinary-C--repo-
my-cool-C#-repo! gets converted to my-cool-C--repo-

Proposed solution

This is a small bug, but I'm wondering if there is a way to ask the user if they want to continue with the repo name they chose given that the actual name will be different than what they typed in. This conformation prompt will only appear when the text they typed in is different than what is to be created on GitHub. I would also assume the confirmation text should be similar to the text on the web site.

Additional context

I don't think another api call will be needed so long as we just run a regex expression for special characters.

If this is something that might interest the team, I'd like to work on it!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementa request to improve CLI

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions