git-grab icon indicating copy to clipboard operation
git-grab copied to clipboard

Support an argument for arbitrary repo names (mostly for gists)

Open brian6932 opened this issue 7 months ago • 2 comments

When I was writing https://github.com/wezm/git-grab/issues/6#issuecomment-2908806196, I realized Gists aren't well supported. They don't have to have an author/org (they're purely optional), and don't have friendly repo names, they're just an MD5 hash. I like to name my gists.

brian6932 avatar May 26 '25 07:05 brian6932

Something like git grab https://gist.github.com/wezm/29a8fd328163cbc4723765c3c8c76dfd -n meminfo and have that clone into $GRAB_HOME/gist.github.com/wezm/meminfo?

wezm avatar May 28 '25 00:05 wezm

Yep, it's just that gists can also be cloned like git grab https://gist.github.com/29a8fd328163cbc4723765c3c8c76dfd -n meminfo, for both HTTP and SSH. If the login name's wanted, even in those cases (before they moved to MD5, they just bumped a uint, you can find some old gists like that, they work the same), the GH API can be queried: https://api.github.com/gists/253347b2c9a53bbd6087f086970106b6, the .owner.login property would have the username. Another option's to keep the MD5 hash in the path, but with a separator to a friendly name ($GRAB_HOME/gist.github.com/meminfo-29a8fd328163cbc4723765c3c8c76dfd), that'd result in an easier to reference clone name, would remove chance of collisions, while still working for things like zoxide and shell TAB completion 🤔.

brian6932 avatar May 28 '25 11:05 brian6932