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

Add GitHub user/repo generator #42

Open
clo4 opened this issue Mar 28, 2022 · 0 comments
Open

Add GitHub user/repo generator #42

clo4 opened this issue Mar 28, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@clo4
Copy link
Contributor

clo4 commented Mar 28, 2022

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,
    }),
  }
}
@clo4 clo4 added the enhancement New feature or request label Mar 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant