@screencloud/fetch-github-release
v1.2.2
Published
CLI downloader for github release assets
Downloads
8
Readme
@screencloud/fetch-github-release
a micro CLI tool for downloading named assets from tagged github releases
Installation
Install as
npm i -g @screencloud/fetch-github-release
Afterwards use fetch-github-release
or simply fghr
.
Configuration
Run fghr -h
for a comprehensive help
screencloud/fetch-github-release cli
Usage: cli [options]
Options:
-V, --version output the version number
-m, --make-dir Creates the output directory if it doesn't exist yet
-t, --token <token> Github token to be used (default: GH_TOKEN|GITHUB_TOKEN) (default: "b1885a63210480d6bb422fe079fb9dbd1290aeb3")
-v, --tag <tag> Github release tag (default: GH_TAG|GITHUB_TAG)
-r, --repo <github repo slug> Target github repository slug (default: GH_REPO|GITHUB_REPOSITORY)
-a, --asset <file name> asset name (repeatable, default: GH_ASSET_NAME|GITHUB_ASSET_NAME) (default: [])
-u, --unzip Unpack .zip files automatically into a same-named folder
-o, --output <path> Output path for downloaded assets (default: CWD) (default: "C:\\git\\screencloud\\fetch-github-release")
-h, --help display help for command
Use either arguments or environment variables for configuration.
To download a asset foobar.zip
for release v1.2.3
from github repository example/bob
run
fghr -a foobar.zip -v v1.2.3 -r example/bob -t <your github token>
Or with environment variables in mind
GH_REPO=example/bob GH_TOKEN=<your github token> GH_TAG=v1.2.3
fghr -a foobar.zip
Downloading multiple assets
The --asset|-a argument is repeatable
GH_REPO=example/bob GH_TOKEN=<your github token> GH_TAG=v1.2.3
fghr -a foobar.zip -a alice.zip -a bob.zip
Unzipping downloaded assets
Assets ending in .zip
can be automatically unzipped into a folder of the same name (minus the extension).
Use -u
or --unzip
to do so. All other assets will ignore the flag automatically.