• Stars
    star
    115
  • Rank 306,027 (Top 7 %)
  • Language
    Clojure
  • License
    MIT License
  • Created about 2 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Install any Babashka script or project with one command

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 ~/.babashka/bbin/bin to PATH:

echo 'export PATH="$PATH:$HOME/.babashka/bbin/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%\.babashka\bbin\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 [email protected]: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

  • By default, scripts will be installed to ~/.babashka/bbin/bin
    • If $BABASHKA_BBIN_DIR is set, then use $BABASHKA_BBIN_DIR (explicit override)
    • If $XDG_DATA_HOME is set, then use $XDG_DATA_HOME/.babashka/bbin/bin (Freedesktop conventions)
  • Each bin script is a self-contained shell script that fetches deps and invokes bb with the correct arguments.
  • The bin scripts can be configured using the CLI options or the :bbin/bin key in bb.edn
  • See the FAQ for additional info on setting up your code to work with bbin

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.

  • --as
    • The name of the script to be saved in the bbin bin path
  • --git/sha
    • The SHA for a Git repo
  • --git/tag
    • The tag for a Git repo
  • --git/url
    • The URL for a Git repo
  • --latest-sha
    • If provided, find the latest SHA from the Git repo
  • --local/root
    • The path of a local directory containing a deps.edn file
  • --main-opts
    • The provided options (EDN format) will be passed to the bb command-line when the installed script is run
    • By default, --main-opts will be set to ["-m" ...], inferring the main function from the lib name
    • For example, if you provide a lib name like io.github.rads/watch, bbin will infer rads.watch/-main
    • Project authors can provide a default in the :bbin/bin key in bb.edn
  • --mvn/version
    • The version of a Maven dependency
  • --ns-default
    • The namespace to use to find functions (tool mode only)
    • Project authors can provide a default in the :bbin/bin key in bb.edn
  • --tool
    • If this option is provided, the script will be installed using tool mode
    • When enabled, the installed script acts as an entry point for functions in a namespace, similar to clj -T
    • If no function is provided, the installed script will infer a help message based on the function docstrings

bbin uninstall [script]

Remove a script


bbin ls

List installed scripts


bbin bin

Display bbin bin folder

  • The default folder is ~/.babashka/bbin/bin

bbin version

Display bbin version


bbin help

Display bbin help


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.

More Repositories

1

babashka

Native, fast starting Clojure interpreter for scripting
Clojure
3,642
star
2

sci

Configurable Clojure/Script interpreter suitable for scripting and Clojure DSLs
Clojure
1,221
star
3

nbb

Scripting in Clojure on Node.js using SCI
Clojure
772
star
4

neil

A CLI to add common aliases and features to deps.edn-based projects
Clojure
288
star
5

scittle

Execute Clojure(Script) directly from browser script tags via SCI
Clojure
278
star
6

obb

Ad-hoc ClojureScript scripting of Mac applications via Apple's Open Scripting Architecture.
Clojure
240
star
7

process

Clojure library for shelling out / spawning sub-processes
Clojure
183
star
8

cli

Turn Clojure functions into CLIs!
Clojure
153
star
9

fs

File system utility library for Clojure
Clojure
139
star
10

babashka.curl

A This library is mostly replaced by https://github.com/babashka/http-client
Clojure
119
star
11

pods

Pods support for JVM and babashka
Clojure
100
star
12

http-client

HTTP client for Clojure and Babashka built on java.net.http
Clojure
83
star
13

pod-registry

Pod manifests describe where pods can be downloaded, etc.
Clojure
82
star
14

babashka-sql-pods

Babashka pods for SQL databases
Clojure
72
star
15

pod-babashka-aws

Deprecated, use https://github.com/grzm/awyeah-api
Clojure
61
star
16

http-server

Serve static assets
Clojure
58
star
17

book

Babashka book
Clojure
55
star
18

babashka.nrepl

The nREPL server from babashka as a library, so it can be used from other SCI-based CLIs.
Clojure
52
star
19

pod-babashka-etaoin

Deprecated, use https://github.com/clj-commons/etaoin.
Clojure
41
star
20

tools-deps-native

Run tools.deps as a native binary
Clojure
40
star
21

pod-babashka-go-sqlite3

A babashka pod for interacting with sqlite3.
Go
27
star
22

pod-babashka-filewatcher

Babashka filewatcher pod based on Rust notify
Shell
22
star
23

json

JSON abstraction library
Clojure
19
star
24

pod-babashka-fswatcher

Babashka filewatcher pod.
Go
18
star
25

sci.configs

A collection of ready to be used SCI configs
Clojure
17
star
26

instaparse-bb

Use instaparse from babashka
Clojure
16
star
27

pod-babashka-buddy

A pod around buddy core (Cryptographic Api for Clojure).
Clojure
14
star
28

nbb-features

A collection of premade features for nbb
Clojure
10
star
29

toolbox

Script and template for Babashka Toolbox
HTML
9
star
30

pod-babashka-lanterna

Clojure
9
star
31

pod-babashka-malli

Exposing malli to babashka via a pod
Shell
8
star
32

nrepl-client

Clojure
8
star
33

pod-babashka-parcera

A babashka pod wrapping parcera
Clojure
7
star
34

conf

babashka-conf
Clojure
7
star
35

babashka.core

Babashka core utils
Clojure
5
star
36

pod-babashka-instaparse

Instaparse pod
Clojure
4
star
37

sci.nrepl

Clojure
2
star
38

babashka-dev-builds

2
star
39

.build

[INTERNAL] Common tooling for build orchestration
Clojure
1
star
40

babashka.github.io

Clojure
1
star
41

homebrew-brew

Ruby
1
star