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

Create GitHub CLI extension for getignore #10

Open
tbjers opened this issue Dec 12, 2021 · 2 comments
Open

Create GitHub CLI extension for getignore #10

tbjers opened this issue Dec 12, 2021 · 2 comments

Comments

@tbjers
Copy link
Contributor

tbjers commented Dec 12, 2021

So that PR came as a result of me investigating whether or not it would make sense to make a gh extension for auto-generating .gitignore files based on the existing repo. My Go skills aren't there, but maybe you could take a look at integration/implementation and I can contribute?

Just run gh extension create and it'll guide you through setting one up. I am not sure what the best way to integrate what you have in this repo, so maybe you could advise?

For further info, take a look at this extension base for Go:
https://github.com/cli/go-gh

And here's the documentation for creating pre-compiled Go extensions:
https://docs.github.com/en/github-cli/github-cli/creating-github-cli-extensions#creating-a-precompiled-extension-in-go-with-gh-extension-create

Originally posted by @gotgenes in #9 (comment)

@gotgenes
Copy link
Owner

@tbjers I was unaware there were extensions for gh, a tool I started using last year. I was unaware gh was written in Go, too. Thanks for bringing this idea!

getignore uses the REST API v3. That API actually has a friendly /gitignore endpoint. That's always going to use the github/gitignore repository and always on main branch.

I wanted getignore to have flexibility in case the user wants to retrieve patterns from a different repository, so it does not use the /gitignore endpoint. If you're using gh as a command, I believe it's worth assuming you want the latest patterns from github/gitignore on main, so this flexibility might seem too roundabout since it'd be easier to just use the /gitignore endpoint.

Also, I looked at gh and it seems it uses the GraphQL API v4. I'm having trouble navigating that API to see if it exposes a similar gitignore resource. If it does, it might be more straightforward to take advantage of that.

Curious to hear more of your thoughts!

@tbjers
Copy link
Contributor Author

tbjers commented Dec 12, 2021

@gotgenes I don't think GraphQL has any way to fetch gitignore templates. I think we'd still use the REST API. I like the idea of doing a gh extension though, I think a lot of people would use it if it was available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants