gh-download
gh-download copied to clipboard
Feature request: download assets and the latest release assets
Description It will come handy if this extension could be use to download assets, especially the latest release assets.
Example workflows:
Download assets from a url
gh download https://github.com/pocketbase/pocketbase/releases/tag/v0.7.10- Will prompt which assets to download (since assets usually comes in big sizes):
Select what to download:
[ ] checksums.txt
[ ] pocketbase_0.7.10_darwin_amd64.zip
[ ] pocketbase_0.7.10_darwin_arm64.zip
[ ] pocketbase_0.7.10_linux_amd64.zip
[ ] pocketbase_0.7.10_linux_arm64.zip
[ ] pocketbase_0.7.10_linux_armv7.zip
[ ] pocketbase_0.7.10_windows_amd64.zip
[ ] pocketbase_0.7.10_windows_arm64.zip
[ ] Source code (zip)
[ ] Source code (tar.gz)
[_] Done
[_] Exit
- This could be multiply selected:
Select what to download:
[x] checksums.txt
[ ] pocketbase_0.7.10_darwin_amd64.zip
[ ] pocketbase_0.7.10_darwin_arm64.zip
[x] pocketbase_0.7.10_linux_amd64.zip
[ ] pocketbase_0.7.10_linux_arm64.zip
[ ] pocketbase_0.7.10_linux_armv7.zip
[ ] pocketbase_0.7.10_windows_amd64.zip
[ ] pocketbase_0.7.10_windows_arm64.zip
[ ] Source code (zip)
[ ] Source code (tar.gz)
[_] Done
[_] Exit
- Once "Done" is pressed, it will download the selected files
Download latest version of an asset
gh download https://github.com/pocketbase/pocketbase/releases/tag/v0.7.3 --regex pocketbase_0.7.[0-9]+_linux_amd64.zip(Note: the extra additional tag information is ignored, it's to simplify copying url from browser)- This will download
pocketbase_0.7.10_linux_amd64.zipor whichever version is the latest release of0.7.x
Pick from a release
gh download https://github.com/pocketbase/pocketbase/releases/tag/v0.7.3 --pick-tag(Note: the extra additional tag information is ignored, it's to simplify copying url from browser)- Will prompt which tag to pick (from https://github.com/pocketbase/pocketbase/tags):
Select which tag to download:
[_] v0.8.0-rc2 (3 hours ago)
[_] v0.7.10 (3 hours ago)
[_] v0.8.0-rc1 (4 days ago)
[_] v0.7.9 (29 days ago)
[_] Exit
- The next step will be the same as Download assets from a url
Wow, this cool.
The current code is a simple shell script.
If add interactions in the terminal, I think it may need to be rewrite with other language, e.g. (golang, node.js)
@brainwo
Do you have any good advice?
@yuler Before using this, I experiment making my own extension written in Go. What could I say is a shell script is more fitting for this kind of extension (although I'm not sure if it's running on Windows or not).
- The shell script is more lightweight (5KB compared to 5MB in Go). Not much a size issue, but still nice to have.
- The go-gh library is still in beta. I have trouble when using the GraphQL helper, I had to rewrite it using REST API. I'm not sure but this is my first time writing Go.
If you want to rewrite it, I think Go is a good choice since most other gh extensions is written in Go. I'm personally won't use Node.js, running the script will requires a Node.js runtime installed on the machine which is undesirable if I run it outside of my main machine. Not sure if I will run the script for automation in GitHub Action or not. But for sure, I think of sticking with a simple shell script.