Ghdl - A much more convenient way to download GitHub release binaries on the command line, works on Win & Unix-like systems

ghdl

Memorize ghdl as github download

ghdl is a fast and simple program (and also a golang module) for downloading and installing executable binary from github releases.

animated demo

The demo above extracts fd execuable to current working directory and give execute permission to it.

Features

  • Auto decompressing and unarchiving the downloaded asset (without any system dependencies like tar or unzip)

    Currently supporting unarchiving `tar` and decompressing `zip` `gzip`.
    Package format `deb` `rpm` `apk` will be downloaded directly

    ghdl binary is statically linked, works well on non-FHS *nix systems like NixOS). In case this is relevant to you, on that kind of system, only binaries like ghdl can be run directly.

  • Setups for executable: ghdl moves executable to specified location and add execute permissions to the file.

  • Auto filtering: multiple assets in one release will be filtered by OS or ARCH. This feature can be disabled using -F flag.

  • Interactive TUI: when auto filtering is failed or returned multiple options, you can select assets in a interactive way, with vim key bindings support.

  • Release tags: ghdl downloads latest release by default, other or old tagged releases can be downloaded by specifying release tag: username/repo#tagname

  • Inspect download status with real-time progress bar.

Installation

If you're going to use ghdl as a go module, ignore the following installation progress.

  • Using Go tools:

    go will download the latest version of ghdl to $GOPATH/bin, please make sure $GOPATH is in the PATH:

    go install github.com/beetcb/ghdl/ghdl@latest

    Note: Just to be safe, you'd better specify CGO_ENABLED=0 when running go install on non-FHS *nix systems like NixOS)

  • Download and run executable from release.

  • Run the following shell script(*nix system only):

    curl -fsSL "https://bina.egoist.sh/beetcb/ghdl?dir=/usr/local/bin" | sh
    # feel free to change the `dir` url param to specify the installation directory.

Usage

CLI

Run ghdl --help

❯ ghdl --help

ghdl download binary from github release
ghdl handles archived or compressed file as well

Usage:
  ghdl <user/repo[#tagname]> [flags]

Flags:
  -F, --filter-off    turn off auto-filtering feature
  -h, --help          help for ghdl
  -n, --name string   specify binary file name to enhance filtering and extracting accuracy
  -p, --path path     save binary to path and add execute permission to it (default ".")

It's tedious to specify -p manually, we can alias ghdl -p "$DirInPath" to a shorthand command, then use it as a executable installer.

Go Module

  1. Require ghdl to go.mod

    go get github.com/beetcb/ghdl
  2. Use ghdl's out-of-box utilities: see TestDownloadFdBinary func as an example

Credit

Inspired by egoist/bina, TUI powered by charmbracelet/bubbletea

License

Licensed under MIT

Author: @beetcb | Email: [email protected]

Owner
beet
harder better faster stronger
beet
Similar Resources

A Golang library to manipulate strings according to the word parsing rules of the UNIX Bourne shell.

shellwords A Golang library to manipulate strings according to the word parsing rules of the UNIX Bourne shell. Installation go get github.com/Wing924

Sep 27, 2022

Vulture - A Unix Operating System Built Using Golang

vulture A Unix Operating System Built Using Golang Requirements: macOS: make sur

Dec 30, 2022

The primary place where Optimism works on stuff related to Optimistic Ethereum

The primary place where Optimism works on stuff related to Optimistic Ethereum

The Optimism Monorepo TL;DR This is the primary place where Optimism works on stuff related to Optimistic Ethereum. Documentation Extensive documentat

Dec 16, 2022

Go-turing-i2c-cmdline - Controlling the i2c management bus of the turing pi with i2c works fine

go-turing-i2c-cmdline What is it? Controlling the i2c management bus of the turi

Jan 24, 2022

Works with HashiCorp HCL. Allows to append the input file with blocks and attributes from the template file

About hclmergetool Works with HashiCorp HCL. Allows to append the input file with blocks and attributes from the template file Installation Binary Rel

Feb 6, 2022

The forgotten go tool that executes and caches binaries included in go.mod files.

The forgotten go tool that executes and caches binaries included in go.mod files.

The forgotten go tool that executes and caches binaries included in go.mod files. This makes it easy to version cli tools in your projects such as gol

Sep 27, 2022

Find strings in Go binaries

gostringsr2 gostringsr2 extracts strings from a Go binary using radare2. Tested with radare2 3.7.0, Python 3.7, r2pipe 1.4.1, on OS X and Linux. Teste

Oct 20, 2022

A framework for constructing self-spreading binaries

A framework for constructing self-spreading binaries

A framework that aids in creation of self-spreading software Requirements go get -u github.com/redcode-labs/Coldfire go get -u github.com/yelinaung/go

Jan 2, 2023

Generate random, pronounceable, sometimes even memorable, "superhero like" codenames - just like Docker does with container names.

Codename an RFC1178 implementation to generate pronounceable, sometimes even memorable, "superheroe like" codenames, consisting of a random combinatio

Dec 11, 2022
Comments
  • Allow filtering the list of assets with a regular expression

    Allow filtering the list of assets with a regular expression

    What this PR fixes

    Thanks for this nice tool. While playing with it (I wanted to download assets of golangci-lint, which includes a variery of formats like Debian packages or tar.gz archives for each platform), I wanted to limit the asset list displayed to certain files. In some cases, I knew I wanted to explicitly download *.tar.gz files, but could not find a simple way to filter the assets list further.

    This PR introduces a new '--asset-filter' flag, which is a regexp that is applied against the asset list (right after the OS and Arch filters are applied). If users know exactly which kind of asset they want to download, this might help skip the interactive listing and download the right asset instead.

    Since this is my very first PR in this repo, please do let me know if things ought to be done differently.

  • Failed remove tmp file on windows

    Failed remove tmp file on windows

    .tmp shall be closed first, then remove

    https://github.com/beetcb/ghdl/blob/109da84f71ce86a3c78459c7d7646c6bd0ed7b93/dl.go#L123

    https://github.com/beetcb/ghdl/blob/109da84f71ce86a3c78459c7d7646c6bd0ed7b93/dl.go#L78-L83

  • Binary name shall use `--name` flag with `.exe` extension

    Binary name shall use `--name` flag with `.exe` extension

    Current behavior

    C:\Users\beet\Desktop\share\bin>ghdl caarlos0/tasktimer --name tt
    → start downloading tt_windows_amd64.tar.gz
    
      ███████████████████████████████████ 100% of 6.1 MB
    
    → binary file not found. Try to specify binary name flag
    
    C:\Users\beet\Desktop\share\bin>ghdl caarlos0/tasktimer -n tt.exe
    → start downloading tt_windows_amd64.tar.gz
    
      ███████████████████████████████████ 100% of 6.1 MB
    
    → saved executable to C:\Users\beet\Desktop\share\bin\tt.exe
    

    Related

    https://github.com/beetcb/ghdl/blob/f53255a2ab0f2fae3f8018262f1a072b2e9cd521/ghdl/main.go#L44-L46

Yet another Go REPL that works nicely. Featured with line editing, code completion, and more.
  Yet another Go REPL that works nicely. Featured with line editing, code completion, and more.

gore Yet another Go REPL that works nicely. Featured with line editing, code completion, and more. (Screencast taken with cho45/KeyCast) Usage gore Af

Jan 7, 2023
IBus Engine for GoVarnam. An easy way to type Indian languages on GNU/Linux systems.

IBus Engine For GoVarnam An easy way to type Indian languages on GNU/Linux systems. goibus - golang implementation of libibus Thanks to sarim and haun

Feb 10, 2022
Databases and dashboards loved each other so much that databoard was born.

databoard Work in progress tool to create API endpoints that executes queries on connected database. ⚠ The project is on early-development stage. Plan

Nov 23, 2021
Some convenient string functions.

str Some convenient string functions. What This package containsa couple of functions to remove duplicates from string slices and optionally sort them

Dec 27, 2021
Help to release a project which especially has multiple git repositories

This project aims to help to release a project which especially has multiple git repositories. Installation Install it to a Kubernetes cluster. You ca

Dec 15, 2022
Package buildinfo provides basic building blocks and instructions to easily add build and release information to your app.
Package buildinfo provides basic building blocks and instructions to easily add build and release information to your app.

Package buildinfo provides basic building blocks and instructions to easily add build and release information to your app. This is done by replacing variables in main during build with ldflags.

Nov 14, 2021
Custom release of square/certstrap

certstrap A simple certificate manager written in Go, to bootstrap your own certificate authority and public key infrastructure. Adapted from etcd-ca.

Jun 25, 2022
Quickly clone an entire org/users repositories into one directory - Supports GitHub, GitLab, Bitbucket, and more
Quickly clone an entire org/users repositories into one directory - Supports GitHub, GitLab, Bitbucket, and more

ghorg ghorg allows you to quickly clone all of an orgs, or users repos into a single directory. This can be useful in many situations including Search

Jan 1, 2023
GoThanks automatically stars Go's official repository and your go.mod github dependencies, providing a simple way to say thanks to the maintainers of the modules you use and the contributors of Go itself.
GoThanks automatically stars Go's official repository and your go.mod github dependencies, providing a simple way  to say thanks to the maintainers of the modules you use and the contributors of Go itself.

Give thanks (in the form of a GitHub ★) to your fellow Go modules maintainers. About GoThanks performs the following operations Sends a star to Go's r

Dec 24, 2022
A command-line tool that triggers command when the input (doesn't) comes from STDIN in an interval.

conk A command-line tool that triggers command when the input (doesn't) comes from STDIN in an interval. Usage $ conk -h A command-line tool that trig

Apr 29, 2022