28 releases (13 stable)

1.5.0 Nov 23, 2024
1.3.4 Oct 12, 2024
0.9.1 Aug 3, 2024
0.5.0 Jul 31, 2024

#560 in Command line utilities

Download history 253/week @ 2024-08-12 1/week @ 2024-08-19 32/week @ 2024-09-23 1/week @ 2024-09-30 129/week @ 2024-10-07 34/week @ 2024-10-14 7/week @ 2024-11-04 279/week @ 2024-11-18 36/week @ 2024-11-25

322 downloads per month

GPL-3.0+

77KB
1.5K SLoC

binup

binup tries to become the last tool you'll manually install from GitHub releases. It focuses on single binary apps and allows you to automatically install and upgrade them once you specify rules of how to find each app in release files.

Here is how it works. You run binup install --project KonishchevDmitry/binup and it finds and installs the binary from project releases.

All installed tools are registered in ~/.config/binup/config.yaml which you may edit manually. binup uses nondestructive for config editing, so it tries to preserve the configuration file structure and comments.

When a tool is registered in the configuration file, you may install/reinstall/upgrade it by its name: binup install|upgrade $name. If tool name is not specified, binup installs/upgrades all the registered tools.

Except for the configuration file, binup is fully stateless: it doesn't save any information about installed binaries. Instead, is always checks the actual state of the apps: if binary is missing, it installs it. When the binary is already installed, it runs it with --version argument and tries to parse its actual version to compare with the latest release. If it fails to determine the version (the tool might not have --version flag), binup relies on binary file modification time, always setting it to update time of the downloaded release archive.

Available commands

binup

Automated app installation from GitHub releases

Usage: binup [OPTIONS] <COMMAND>

Commands:
  list       List all configured tools [aliases: l]
  install    Install all or only specified tools [aliases: i]
  upgrade    Upgrade all or only specified tools [aliases: u]
  uninstall  Uninstall the specified tools [aliases: remove, r]

Options:
  -c, --config <PATH>  Configuration file path [default: ~/.config/binup/config.yaml]
  -v, --verbose...     Set verbosity level
  -h, --help           Print help
  -V, --version        Print version

binup list

List all configured tools

Usage: binup list [OPTIONS]

Options:
  -f, --full  Show full information including changelog URL
  -h, --help  Print help

binup install

When no arguments are specified, installs all the tools from the configuration file which
aren't installed yet. When tool name(s) is specified, installs this specific tool(s).

When --project is specified, adds a new tool to the configuration file and installs it.

Usage: binup install [OPTIONS] [NAME]...

Arguments:
  [NAME]...
          Tool name

Options:
  -f, --force
          Force installation even if tool is already installed

  -p, --project <NAME>
          GitHub project to get the release from

  -c, --changelog <URL>
          Project changelog URL

  -r, --release-matcher <PATTERN>
          Release archive pattern

  -b, --binary-matcher <PATTERN>
          Binary path to look for inside the release archive

  -d, --path <PATH>
          Path where to install this specific tool to

  -s, --post <COMMAND>
          Post-install command

  -h, --help
          Print help (see a summary with '-h')

binup upgrade

Upgrade all or only specified tools

Usage: binup upgrade [NAME]...

Arguments:
  [NAME]...  Tool name

Options:
  -h, --help  Print help
laptop:~/src/binup:master$ cargo run -q -- uninstall --help
Uninstall the specified tools

binup uninstall

Arguments:
  <NAME>...  Tool name

Options:
  -h, --help  Print help

Available configuration options

Here is an example config with all available configuration options:

# Path where to install the binaries (the default is ~/.local/bin)
path: /usr/local/bin

tools:
  # Binary name
  prometheus:
    # GitHub project name
    project: prometheus/prometheus

    # Changelog URL (will be printed on app upgrade)
    changelog: https://github.com/prometheus/prometheus/blob/main/CHANGELOG.md

    # Release archive pattern:
    # * By default shell-like glob matching is used (https://docs.rs/globset/latest/globset/#syntax)
    # * Pattern started with '~' is treated as regular expression (https://docs.rs/regex/latest/regex/#syntax)
    #
    # If it's not specified, the archive will be chosen automatically according to target platform.
    release_matcher: prometheus-*.linux-amd64.tar.gz

    # Binary path to look for inside the release archive. If it's not specified, the tool will try to find it automatically.
    binary_matcher: "*/prometheus"

    # Path where to install this specific tool to
    path: ~/bin

    # Post-install command
    post: systemctl restart prometheus

# If you have a lot of tools, you may hit GitHub API rate limits for anonymous requests at some moment.
# So it's recommended to obtain GitHub token (https://github.com/settings/tokens) and specify it here.
# No permissions are required for the token – it's needed just to make API requests non-anonymous.
github:
  token: $token

binup edits the configuration file only in the following cases:

  1. When --project is specified in the install command and the specified parameters doesn't match already registered ones;
  2. In the uninstall command.

If you don't feel comfortable when some app automatically edit your configs, you can register all tools manually and run binup install|upgrade $name – when --project is not specified, the tool never touches the config.

Dependencies

~30–49MB
~841K SLoC