Skip to content

Add GitHub user/repo generator #42

Open
@clo4

Description

@clo4

I will work on this.

Using username/repo is a common shorthand for GitHub repos, used at minimum by:

  • degit
  • gh
  • brew tap

And I frequently find myself using this pattern for personal CLIs (eg. vim package manager, git clone for my own directory structure, etc)

What would be necessary:

  • Sort by stars
  • Map user suggestion (user: Fig.Suggestion) => Fig.Suggestion
  • Map repo suggestion (repo: Fig.Suggestion) => Fig.Suggestion
  • Disable user suggestions
  • Disable repo suggestions
  • Conditionally disable, default would be lastToken.slice(lastToken.indexOf("/")).match(githubUsernameRegex)
import { github } from "@fig/generators";

// ...

{
  args: {
    debounce: true,
    generators: github({
      // Could be `suggestUsers?: boolean | ((user: Fig.Suggestion) => Fig.Suggestion)
      suggestUsers: false,
      suggestRepos: (repo) => ({ ...repo, icon: "📦" }),
      includeForks: false,
      includeTemplates: false,
    }),
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions