babashka / bbin

Install any Babashka script or project with one command
MIT License
134 stars 9 forks source link
babashka bash bbin cli clojure clojurescript linux macos package-manager shell windows zsh

bbin

Install any Babashka script or project with one command.

$ bbin install io.github.babashka/neil
{:lib io.github.babashka/neil,
 :coords
 {:git/url "https://github.com/babashka/neil",
  :git/tag "v0.1.45",
  :git/sha "0474d4cb5cfb0207265a4508a0e82ae7a293ab61"}}

$ neil --version
neil 0.1.45

$ bbin install https://gist.githubusercontent.com/rads/da8ecbce63fe305f3520637810ff9506/raw/25e47ce2fb5f9a7f9d12a20423e801b64c20e787/portal.clj
{:coords {:bbin/url "https://gist.githubusercontent.com/rads/da8ecbce63fe305f3520637810ff9506/raw/25e47ce2fb5f9a7f9d12a20423e801b64c20e787/portal.clj"}}

# Open a Portal window with all installed scripts
$ portal <(bbin ls)

📦 See the Scripts and Projects wiki page for a list of CLI tools from the community. This list is just a starting point — any existing Babashka script or project can be installed out-of-the-box!

📚 See the Usage and CLI docs for more examples of what bbin can do.

Table of Contents

Installation

Homebrew (Linux and macOS)

1. Install via brew:

brew install babashka/brew/bbin

2. Add ~/.local/bin to PATH:

echo 'export PATH="$PATH:$HOME/.local/bin"' >> ~/.$(basename $SHELL)rc && exec $SHELL

Scoop (Windows)

1. Install bbin CLI:

scoop bucket add scoop-clojure https://github.com/littleli/scoop-clojure
scoop install bbin

The Scoop package will automatically update your Path with %HOMEDRIVE%%HOMEPATH%\.local\bin, but you will have to restart your terminal for this to take effect.

Manual (Linux, macOS, and Windows)

Click here for manual installation instructions.

Usage

# Install a script from a qualified lib name
$ bbin install io.github.babashka/neil
$ bbin install io.github.rads/watch --latest-sha
$ bbin install org.babashka/http-server --mvn/version 0.1.11

# Install an auto-generated CLI from a namespace of functions
$ bbin install io.github.borkdude/quickblog --tool --ns-default quickblog.api

# Install a script from a URL
$ bbin install https://gist.githubusercontent.com/rads/da8ecbce63fe305f3520637810ff9506/raw/25e47ce2fb5f9a7f9d12a20423e801b64c20e787/portal.clj
$ bbin install https://github.com/babashka/http-server/releases/download/v0.1.11/http-server.jar

# Install a script from a Git repo
$ bbin install https://gist.github.com/1d7670142f8117fa78d7db40a9d6ee80.git
$ bbin install git@gist.github.com:1d7670142f8117fa78d7db40a9d6ee80.git

# Install a script from a local file
$ bbin install foo.clj
$ bbin install http-server.jar

# Install a script from a local root (with no lib name)
$ git clone https://github.com/babashka/bbin.git ~/src/bbin
$ bbin install ~/src/bbin --as bbin-dev

# Install a script from a local root (with lib name)
$ bbin install io.github.babashka/bbin --local/root ~/src/bbin --as bbin-dev

# Remove a script
$ bbin uninstall watch

# Show installed scripts
$ bbin ls

# Show the bin path
$ bbin bin

Docs

CLI


bbin install [script]

Install a script

Example bb.edn Config:

{:bbin/bin {neil {:main-opts ["-f" "neil"]}}}

Supported Options:

Note: bbin will throw an error if conflicting options are provided, such as using both --git/sha and --mvn/version at the same time.

If no --git/tag or --git/sha is provided, the latest tag from the Git repo will be used. If no tags exist, the latest SHA will be used.

bbin uninstall [script]

Remove a script


bbin ls

List installed scripts


bbin bin

Display bbin bin folder


bbin version

Display bbin version


bbin help

Display bbin help


bbin migrate

Migrate from bbin v0.1.x


Dev

To install a development version of bbin, first install bbin stable, then install bbin with bbin.

$ bbin install . --as bbin-dev --main-opts '["-m" babashka.bbin.cli/-main]'

You can now run your development copy of bbin with bbin-dev. Rebuilding is not required for bbin-dev installed this way, changes in Clojure source code is reflected instantly.

Contributing

If you'd like to contribute to bbin, you're welcome to create issues for ideas, feature requests, and bug reports.

License

bbin is released under the MIT License.