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 gist clone
command
#2222
add gist clone
command
#2222
Conversation
gistURL = ghinstance.GistPrefix(hostname) + gistURL | ||
} | ||
|
||
_, err := git.RunClone(gistURL, opts.GitArgs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The repo clone
command sets the upstream
repository of a fork automatically on clone so I tried to do this for the gist clone
command as well.
However, it looks like while the gist GraphQL Object can tell if its a fork or not, it doesn't have any link to the parent gist.
pkg/cmd/gist/clone/clone.go
Outdated
|
||
if !git.IsURL(gistURL) { | ||
hostname := ghinstance.OverridableDefault() | ||
gistURL = ghinstance.GistPrefix(hostname) + gistURL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't add the protocol here because it would have required changes on the ghrepo.FromFullName function and cloning worked without it but happy to do that if required!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you for this! I tested it out locally and it worked well~
I'd love for this command to respect the git_protocol
setting. I have mine set for ssh
but the origin
remote on my clone used https
; could you try adding support for that? I'm happy to help if it's unclear how to do so or if any of the supporting functions need refactoring.
Thanks for the review @vilmibm -- makes total sense! I'll try to make the requested changes on the weekend and report back then! |
This adds the ability to clone a gist. Usage: ```sh $ gh gist clone 5b0e0062eb8e9654adad7bb1d81cc75f $ gh gist clone https://gist.github.com/OWNER/5b0e0062eb8e9654adad7bb1d81cc75f ``` This closes cli#2115.
Updated to take |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you!!!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
222
This adds the ability to clone a gist, very similar to the
repo clone
command.Usage:
This closes #2115.