lmjtfy.git / tools / example
1#!/usr/bin/env bash

A package's example program, built by buck2 and run:

tools/example <package> <example> [--] [its arguments]      (or `mise run example ...`)
tools/example card dump /tmp/cards
6set -euo pipefail
7cd "$(dirname "$0")/.."
8[ "$#" -ge 2 ] || { echo "usage: tools/example <package> <example> [--] [arguments]" >&2; exit 2; }
9command -v buck2 >/dev/null 2>&1 || { echo "example: buck2 is not on PATH (mise install, and run this through mise)" >&2; exit 1; }
10package="$1" example="$2"
11shift 2
12[ "${1:-}" != -- ] || shift
13tools/configure.sh
14exec buck2 run "//packages/$package:$example" -- "$@"