Skip to content

practical-coder/target

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TarGET

List and download latest release asset for the given github repository

Installation

Using Go native modules installation:

go install github.com/practical-coder/target

You should have target command available in your environment:

TarGET - download latest github project release

Usage:
  target [flags]
  target [command]

Available Commands:
  completion  Generate the autocompletion script for the specified shell
  get         Get / Download release asset file
  help        Help about any command
  list        List release assets
  version     TarGET version

Flags:
  -h, --help   help for target

Use "target [command] --help" for more information about a command.

Description

CLI tool to list and download github release assets. Let us take the repo of haproxytech/dataplaneapi as an example.

Listing available assets from the latest release

target list --repo='haproxytech/dataplaneapi'

Output:

checksums.txt
dataplaneapi_2.8.1_darwin_arm64.tar.gz
dataplaneapi_2.8.1_darwin_x86_64.tar.gz
dataplaneapi_2.8.1_freebsd_arm.tar.gz
dataplaneapi_2.8.1_freebsd_arm64.tar.gz
dataplaneapi_2.8.1_freebsd_i386.tar.gz
dataplaneapi_2.8.1_freebsd_x86_64.tar.gz
dataplaneapi_2.8.1_linux_amd64.apk
dataplaneapi_2.8.1_linux_amd64.deb
dataplaneapi_2.8.1_linux_amd64.rpm
dataplaneapi_2.8.1_linux_arm.apk
dataplaneapi_2.8.1_linux_arm.deb
dataplaneapi_2.8.1_linux_arm.rpm
dataplaneapi_2.8.1_linux_arm.tar.gz
dataplaneapi_2.8.1_linux_arm64.apk
dataplaneapi_2.8.1_linux_arm64.deb
dataplaneapi_2.8.1_linux_arm64.rpm
dataplaneapi_2.8.1_linux_arm64.tar.gz
dataplaneapi_2.8.1_linux_i386.apk
dataplaneapi_2.8.1_linux_i386.deb
dataplaneapi_2.8.1_linux_i386.rpm
dataplaneapi_2.8.1_linux_i386.tar.gz
dataplaneapi_2.8.1_linux_ppc64le.apk
dataplaneapi_2.8.1_linux_ppc64le.deb
dataplaneapi_2.8.1_linux_ppc64le.rpm
dataplaneapi_2.8.1_linux_ppc64le.tar.gz
dataplaneapi_2.8.1_linux_s390x.apk
dataplaneapi_2.8.1_linux_s390x.deb
dataplaneapi_2.8.1_linux_s390x.rpm
dataplaneapi_2.8.1_linux_s390x.tar.gz
dataplaneapi_2.8.1_linux_x86_64.tar.gz

List assets with custom formatting

By default output formatting shows just a name of an asset.
It is possible to specify custom formatting for the output using --format.
Format flag is using standard Go Templates syntax.

target list --repo 'haproxytech/dataplaneapi' --format='{{printf "%s\t\t%s" .Name .BrowserDownloadURL}}'

Output:

checksums.txt		https://github.com/haproxytech/dataplaneapi/releases/download/v2.8.1/checksums.txt
dataplaneapi_2.8.1_darwin_arm64.tar.gz		https://github.com/haproxytech/dataplaneapi/releases/download/v2.8.1/dataplaneapi_2.8.1_darwin_arm64.tar.gz
dataplaneapi_2.8.1_darwin_x86_64.tar.gz		https://github.com/haproxytech/dataplaneapi/releases/download/v2.8.1/dataplaneapi_2.8.1_darwin_x86_64.tar.gz
dataplaneapi_2.8.1_freebsd_arm.tar.gz		https://github.com/haproxytech/dataplaneapi/releases/download/v2.8.1/dataplaneapi_2.8.1_freebsd_arm.tar.gz
dataplaneapi_2.8.1_freebsd_arm64.tar.gz		https://github.com/haproxytech/dataplaneapi/releases/download/v2.8.1/dataplaneapi_2.8.1_freebsd_arm64.tar.gz
dataplaneapi_2.8.1_freebsd_i386.tar.gz		https://github.com/haproxytech/dataplaneapi/releases/download/v2.8.1/dataplaneapi_2.8.1_freebsd_i386.tar.gz
dataplaneapi_2.8.1_freebsd_x86_64.tar.gz		https://github.com/haproxytech/dataplaneapi/releases/download/v2.8.1/dataplaneapi_2.8.1_freebsd_x86_64.tar.gz
dataplaneapi_2.8.1_linux_amd64.apk		https://github.com/haproxytech/dataplaneapi/releases/download/v2.8.1/dataplaneapi_2.8.1_linux_amd64.apk
dataplaneapi_2.8.1_linux_amd64.deb		https://github.com/haproxytech/dataplaneapi/releases/download/v2.8.1/dataplaneapi_2.8.1_linux_amd64.deb
dataplaneapi_2.8.1_linux_amd64.rpm		https://github.com/haproxytech/dataplaneapi/releases/download/v2.8.1/dataplaneapi_2.8.1_linux_amd64.rpm
dataplaneapi_2.8.1_linux_arm.apk		https://github.com/haproxytech/dataplaneapi/releases/download/v2.8.1/dataplaneapi_2.8.1_linux_arm.apk
dataplaneapi_2.8.1_linux_arm.deb		https://github.com/haproxytech/dataplaneapi/releases/download/v2.8.1/dataplaneapi_2.8.1_linux_arm.deb
dataplaneapi_2.8.1_linux_arm.rpm		https://github.com/haproxytech/dataplaneapi/releases/download/v2.8.1/dataplaneapi_2.8.1_linux_arm.rpm
dataplaneapi_2.8.1_linux_arm.tar.gz		https://github.com/haproxytech/dataplaneapi/releases/download/v2.8.1/dataplaneapi_2.8.1_linux_arm.tar.gz
dataplaneapi_2.8.1_linux_arm64.apk		https://github.com/haproxytech/dataplaneapi/releases/download/v2.8.1/dataplaneapi_2.8.1_linux_arm64.apk
dataplaneapi_2.8.1_linux_arm64.deb		https://github.com/haproxytech/dataplaneapi/releases/download/v2.8.1/dataplaneapi_2.8.1_linux_arm64.deb
dataplaneapi_2.8.1_linux_arm64.rpm		https://github.com/haproxytech/dataplaneapi/releases/download/v2.8.1/dataplaneapi_2.8.1_linux_arm64.rpm
dataplaneapi_2.8.1_linux_arm64.tar.gz		https://github.com/haproxytech/dataplaneapi/releases/download/v2.8.1/dataplaneapi_2.8.1_linux_arm64.tar.gz
dataplaneapi_2.8.1_linux_i386.apk		https://github.com/haproxytech/dataplaneapi/releases/download/v2.8.1/dataplaneapi_2.8.1_linux_i386.apk
dataplaneapi_2.8.1_linux_i386.deb		https://github.com/haproxytech/dataplaneapi/releases/download/v2.8.1/dataplaneapi_2.8.1_linux_i386.deb
dataplaneapi_2.8.1_linux_i386.rpm		https://github.com/haproxytech/dataplaneapi/releases/download/v2.8.1/dataplaneapi_2.8.1_linux_i386.rpm
dataplaneapi_2.8.1_linux_i386.tar.gz		https://github.com/haproxytech/dataplaneapi/releases/download/v2.8.1/dataplaneapi_2.8.1_linux_i386.tar.gz
dataplaneapi_2.8.1_linux_ppc64le.apk		https://github.com/haproxytech/dataplaneapi/releases/download/v2.8.1/dataplaneapi_2.8.1_linux_ppc64le.apk
dataplaneapi_2.8.1_linux_ppc64le.deb		https://github.com/haproxytech/dataplaneapi/releases/download/v2.8.1/dataplaneapi_2.8.1_linux_ppc64le.deb
dataplaneapi_2.8.1_linux_ppc64le.rpm		https://github.com/haproxytech/dataplaneapi/releases/download/v2.8.1/dataplaneapi_2.8.1_linux_ppc64le.rpm
dataplaneapi_2.8.1_linux_ppc64le.tar.gz		https://github.com/haproxytech/dataplaneapi/releases/download/v2.8.1/dataplaneapi_2.8.1_linux_ppc64le.tar.gz
dataplaneapi_2.8.1_linux_s390x.apk		https://github.com/haproxytech/dataplaneapi/releases/download/v2.8.1/dataplaneapi_2.8.1_linux_s390x.apk
dataplaneapi_2.8.1_linux_s390x.deb		https://github.com/haproxytech/dataplaneapi/releases/download/v2.8.1/dataplaneapi_2.8.1_linux_s390x.deb
dataplaneapi_2.8.1_linux_s390x.rpm		https://github.com/haproxytech/dataplaneapi/releases/download/v2.8.1/dataplaneapi_2.8.1_linux_s390x.rpm
dataplaneapi_2.8.1_linux_s390x.tar.gz		https://github.com/haproxytech/dataplaneapi/releases/download/v2.8.1/dataplaneapi_2.8.1_linux_s390x.tar.gz
dataplaneapi_2.8.1_linux_x86_64.tar.gz		https://github.com/haproxytech/dataplaneapi/releases/download/v2.8.1/dataplaneapi_2.8.1_linux_x86_64.tar.gz

Get asset file

Download asset file to current directory:

target get --repo 'haproxytech/dataplaneapi' --file='dataplaneapi_2.8.1_linux_x86_64.tar.gz'

Get asset file using pattern

Download asset file using regular expression pattern to select particular asset.

target get --repo 'haproxytech/dataplaneapi' --pattern='linux_amd64.deb'

About

TarGET: download latest github release

Resources

Stars

Watchers

Forks

Packages

No packages published