Skip to content

can't see a clear way to show all available options for gh repo create <name> -l <license> #8946

Closed

Description

@devhindo

provide a list of available options for things like --gitignore or --license

example:
gh repo create --license -l

mit
etc.

gh repo create --gitignore -l

Go
Node

reason: I don't know whether it's Go or go and I don't find other way than trying until it works
also mit or MIT? what if I wanted to check if new licenses are getting added?
also idk if this is the best syntax for listing these options or not. knowing that it's not available on the docs

Activity

  1. added
    enhancement
    on Apr 8, 2024
  2. added
    needs-triage
    on Apr 8, 2024
  3. changed the title [-]can't see a clear way to show all available options for `gh repo create <name> -l <license>[/-] [+]can't see a clear way to show all available options for `gh repo create <name> -l <license>`[/+] on Apr 8, 2024
  4. andyfeller commented on Apr 8, 2024

    @andyfeller
    Contributor

    @devhindo : As these options are governed beyond gh by GitHub API endpoint in github/gitignore and choosealicense.com, I think its fair we should at least have the documentation point the user to refer to these sites for more information.

    While this idea of a semi-flag for listing options is interesting, I don't think it is realistic with how most argument and flag parsing libraries work. Again, the GitHub CLI doesn't govern what is a valid value.

  5. added
    gh-repo
    on Apr 8, 2024
  6. devhindo commented on Apr 8, 2024

    @devhindo
    Author

    @andyfeller So, Can't we just provide a CLI option to make a GET request to these external APIs to list the available flag options? If not, We could provide these links in the docs under each flag to be more clear (as the docs were the first place I headed to when I couldn't enter a valid license and found nothing there). I also can't find the code for the mentioned documentation page where I can contribute and add the links you provided.

  7. babakks commented on Apr 8, 2024

    @babakks
    Member

    @devhindo You can find the documentation for gh repo create command here.

  8. devhindo commented on Apr 8, 2024

    @devhindo
    Author

    @babakks Okay so that's fetched directly in the docs website here?
    @andyfeller A PR that enhances the description of the -g and -l flags to include where the options can be found would be appropriate?

  9. babakks commented on Apr 8, 2024

    @babakks
    Member

    @devhindo I think what you see in the CLI manual website you mentioned above is actually generated from the code (@andyfeller please correct if I'm wrong). So if you update the docs in the code, then both the the CLI manual website and the gh repo create --help output will be updated, in the next release.

  10. andyfeller commented on Jul 9, 2024

    @andyfeller
    Contributor

    @devhindo : My sincere apologies for letting this slip from the notification box! 🙇

    So, Can't we just provide a CLI option to make a GET request to these external APIs to list the available flag options?

    That is a possibility on top of updating the help usage information, yeah.

    Looking through gh reference and gh repo create --help, we don't really have anything to help users make the connection much less retrieve the content and present options. 🤔 The only thing I'm aware of is the mislav/gh-license extension that @mislav created for adding a license to an existing repository.

    So what might this look like?

    Perhaps this is something similar to gh repo deploy-key with new subcommandsets?

    gh repo gitignore list
    gh repo gitignore view [ template ]
    gh repo license list
    gh repo license view [ SPDX identifier ]
    gh repo deploy-key --help example

    $ gh repo deploy-key --help
    Manage deploy keys in a repository
    
    USAGE
      gh repo deploy-key <command> [flags]
    
    AVAILABLE COMMANDS
      add:         Add a deploy key to a GitHub repository
      delete:      Delete a deploy key from a GitHub repository
      list:        List deploy keys in a GitHub repository
    
    FLAGS
      -R, --repo [HOST/]OWNER/REPO   Select another repository using the [HOST/]OWNER/REPO format
    
    INHERITED FLAGS
      --help   Show help for command
    
    LEARN MORE
      Use `gh <command> <subcommand> --help` for more information about a command.
      Read the manual at https://cli.github.com/manual

    This would be the ideal experience but certainly no small amount of work especially given the need for testing.

    So what do we do here?

    I think there are 2 actions to take here:

    1. Short term solution: Update gh repo create documentation with information pointing users to the URLs above
    2. Long term solution: Add new subcommandsets to gh repo as described above

    For the former, I think it makes the most sense to expand the Long documentation section with the links so others can follow:

    cmd := &cobra.Command{
    Use: "create [<name>]",
    Short: "Create a new repository",
    Long: heredoc.Docf(`
    Create a new GitHub repository.
    To create a repository interactively, use %[1]sgh repo create%[1]s with no arguments.
    To create a remote repository non-interactively, supply the repository name and one of %[1]s--public%[1]s, %[1]s--private%[1]s, or %[1]s--internal%[1]s.
    Pass %[1]s--clone%[1]s to clone the new repository locally.
    To create a remote repository from an existing local repository, specify the source directory with %[1]s--source%[1]s.
    By default, the remote repository name will be the name of the source directory.
    Pass %[1]s--push%[1]s to push any local commits to the new repository.
    `, "`"),
    Example: heredoc.Doc(`
    # create a repository interactively
    gh repo create
    # create a new remote repository and clone it locally
    gh repo create my-project --public --clone
    # create a remote repository from the current directory
    gh repo create my-project --private --source=. --remote=upstream
    `),

  11. removed
    needs-triage
    on Jul 9, 2024
  12. primlock commented on Jul 23, 2024

    @primlock

    Hey @andyfeller any updates on this? I was using gh repo create <name> --gitignore today and had to guess the spelling of the template I was after. Didn't realize until after I started digging around that the templates are at github/gitignore. It would be nice if under the -g, --gitignore <string> flag description of gh_repo_create there was a link to the available templates.

  13. added
    help wanted
    on Sep 16, 2024
  14. andyfeller commented on Sep 16, 2024

    @andyfeller
    Contributor

    Hey @andyfeller any updates on this? I was using gh repo create <name> --gitignore today and had to guess the spelling of the template I was after. Didn't realize until after I started digging around that the templates are at github/gitignore. It would be nice if under the -g, --gitignore <string> flag description of gh_repo_create there was a link to the available templates.

    Sorry for missing this, @ReynCode. This issue was open for anyone to pick up, but threw together a quick PR in #9630, getting docs updated at least.

  15. Mmohmd commented on Oct 4, 2024

    @Mmohmd

  16. Shion1305 commented on Oct 4, 2024

    @Shion1305
    Contributor

    I'll work on this:)

  17. devhindo commented on Oct 4, 2024

    @devhindo
    Author

    I'll work on this:)

    Good luck!

  18. BagToad commented on Oct 6, 2024

    @BagToad
    Member

    👋 Hey @Shion1305, so sorry I didn't comment on this when I had started, that is my mistake 😔 I already have work done on this, so I wrapped it up and opened a PR in #9721.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementgh-repohelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions