Find a file
2016-10-31 19:11:27 -07:00
extras Move just.sh to extras/just.sh 2016-10-30 18:20:08 -07:00
src Rename arguments to parameters. 2016-10-31 19:11:27 -07:00
.gitignore Ignore /tmp and /target 2016-10-03 23:56:09 -07:00
Cargo.lock Update Cargo.lock 2016-10-30 22:53:15 -07:00
Cargo.toml Update description 2016-10-30 22:55:03 -07:00
clippy.toml Make clippy more lenient with cyclomatic complexity 2016-10-30 17:14:06 -07:00
grammar.md grammar.md phrasing 2016-10-30 19:40:11 -07:00
justfile variable=value overrides done 2016-10-30 03:08:28 -07:00
notes Rename arguments to parameters. 2016-10-31 19:11:27 -07:00
README.md Rename arguments to parameters. 2016-10-31 19:11:27 -07:00

just

crates.io version

just is a handy way to save and run commands.

Commands are stored in a file called justfile with a syntax inspired by make:

# test everything. must build first
test-all: build
  test --all

# run a specific test by passing it as an argument: `just test server-test`
test TEST: build
  test --test {{TEST}}

# build the binary
build:
  cc *.c -o main

version = "0.2.0"
tardir  = "awesomesauce-" + version
tarball = tardir + ".tar.gz"

build-tarball:
	rm -f {{tarball}}
	mkdir {{tardir}}
	cp README.md *.c {{tardir}}
	tar zcvf {{tarball}} {{tardir}}
	rm -rf {{tardir}}

publish: test build-tarball
  scp {{tarball}} me@server.com:release/

# recipes can be written in any language
serve-docs:
	#!/usr/bin/env python3
	import os, http.server, socketserver
	PORT = 8000
	Handler = http.server.SimpleHTTPRequestHandler
  os.chdir('docs')
	httpd = socketserver.TCPServer(("", PORT), Handler)
	print("serving at port", PORT)
	httpd.serve_forever()

just avoids make's idiosyncrasies and produces excellent error messages, so debugging a justfile is easier and less suprising than debugging a makefile.

getting started

just should run on any system with a reasonable sh, and can be installed with cargo, the rust language package manager:

  1. Get rust and cargo from rustup.rs
  2. Run cargo install just
  3. Add ~/.cargo/bin to your PATH

Then, create a file called justfile in the root of your project and start adding recipes to it.

Optionally, you can alias j=just for lighting fast command running.