tools

various tools I have been using throughout the years
Log | Files | Refs | README | LICENSE

commit 1089295496d18416b7f539d2ccce4714f733648c
parent a1ff38e7714d72b4bbc719d1f9c575fc18a474ed
Author: mtmn <miro@haravara.org>
Date:   Sat,  8 Aug 2026 22:41:31 +0200

well knit builds

Diffstat:
MREADME.md | 10+++++++---
Mjustfile | 20++++----------------
Mknitfile | 43+++++++++++++++++++++++++++++++------------
3 files changed, 42 insertions(+), 31 deletions(-)

diff --git a/README.md b/README.md @@ -48,13 +48,17 @@ just run <target> # build and run a tool ## Deploying -Builds and copies binaries to `$HOME/.local/bin`: +Knit builds and copies binaries to `$HOME/.local/bin`: ```sh -just deploy <target> +knit deploy/<target> +knit deploy/all # build and install every tool ``` -`deploy mpd` installs the configured `mpd_*` binaries. Deployed Python tools +The equivalent convenience wrapper is `just deploy <target>`. + +`knit deploy/mpd` (or `just deploy mpd`) installs the configured `mpd_*` +binaries. Deployed Python tools (diggah, lazymaster, nts, shuffle) are thin shims that run out of this repository's `.venv`, and deployed Ruby tools (hue, reflink-snap) run straight from the checkout; both need the checkout to stay in place. diff --git a/justfile b/justfile @@ -1,11 +1,6 @@ knit := "knit" cargo := "cargo" -deploy_dir := home_directory() / ".local/bin" - -# The MPD C binaries deployed under the umbrella name "mpd" -mpd_bins := "mpd_add_to_playlist mpd_add_to_queue mpd_edit_queue mpd_update_library mpd_update_queue mpd_insert_next mpd_edit_playlist mpd_now_playing mpd_trim_queue mpd_report mpd_report_monthly" - # Show this help message default: @just --list @@ -14,7 +9,7 @@ default: all: {{ knit }} all -# Build one or more tools, e.g. just build lazymaster +# Build one or more tools build +targets: {{ knit }} {{ "bin/" + replace(targets, " ", " bin/") }} @@ -24,17 +19,9 @@ run target *args: # Build and copy tools to ~/.local/bin deploy +targets: - @install -d -m 700 {{ deploy_dir }} - @for target in {{ targets }}; do \ - case "$target" in mpd) bins="{{ mpd_bins }}" ;; *) bins="$target" ;; esac; \ - for bin in $bins; do \ - {{ knit }} bin/"$bin" && \ - install -m 755 bin/"$bin" {{ deploy_dir }}/ && \ - echo "deployed $bin to {{ deploy_dir }}"; \ - done; \ - done + {{ knit }} {{ "deploy/" + replace(targets, " ", " deploy/") }} -# Run the native test suites (Rust, Zig, Go) +# Run all test suites test: {{ cargo }} test --workspace cd pracomer && zig build test @@ -63,5 +50,6 @@ cargo-lockfile: clean: {{ cargo }} clean for dir in pmn pracomer speediness; do rm -rf "$dir"/zig-out "$dir"/.zig-cache; done + for dir in hue; do rm -rf "$dir"/vendor; done find bin -type f -delete rm -rf .venv .knit .venv-stamp diff --git a/knitfile b/knitfile @@ -1,6 +1,18 @@ -knit = require("knit") - -root = knit.abs(".") +local knit = require("knit") + +local root = knit.abs(".") +local deploy_dir = cli.deploy_dir or env.HOME .. "/.local/bin" + +rust_bins := bin/dam bin/lastfm_rs bin/plants +zig_bins := bin/pmn bin/pracomer bin/speediness +go_bins := bin/wrd +python_bins := bin/diggah bin/lazymaster bin/nts bin/shuffle bin/kundali +ruby_bins := bin/hue bin/reflink-snap +mpd_queue_bins := bin/mpd_add_to_queue bin/mpd_edit_queue bin/mpd_update_queue bin/mpd_insert_next bin/mpd_trim_queue +mpd_playlist_bins := bin/mpd_add_to_playlist bin/mpd_edit_playlist bin/mpd_update_library +mpd_report_bins := bin/mpd_now_playing bin/mpd_report bin/mpd_report_monthly +mpd_bins := $mpd_queue_bins $mpd_playlist_bins $mpd_report_bins +bins := $rust_bins $zig_bins $go_bins $mpd_bins $python_bins $ruby_bins cflags := -std=c17 -D_POSIX_C_SOURCE=200809L -Wall -Wextra -Wconversion -Wstrict-prototypes -O2 -march=native -mtune=native -fanalyzer -Wshadow -fstack-protector-strong -D_FORTIFY_SOURCE=2 -fPIE -Wformat -Werror=format-security -Wnull-dereference -Wdangling-pointer -Wtrampolines -Walloca -Wcast-align=strict -Wdate-time -Wfloat-equal -Wpointer-arith -Wredundant-decls -Wswitch-default -Wvla -Wwrite-strings ldflags := -lmpdclient -Wl,-z,relro -Wl,-z,now @@ -103,13 +115,20 @@ $ bin/reflink-snap: reflink-snap/reflink-snap.rb printf '#!/bin/sh\nexec ruby "%s/reflink-snap/reflink-snap.rb" "$$@"\n' $root > $output chmod +x $output -$ all:VB: bin/dam bin/lastfm_rs bin/plants \ - bin/pmn bin/pracomer bin/speediness \ - bin/wrd \ - bin/mpd_add_to_playlist bin/mpd_add_to_queue bin/mpd_edit_queue \ - bin/mpd_update_library bin/mpd_update_queue bin/mpd_insert_next \ - bin/mpd_edit_playlist bin/mpd_now_playing bin/mpd_trim_queue \ - bin/mpd_report bin/mpd_report_monthly \ - bin/diggah bin/lazymaster bin/nts bin/shuffle bin/kundali \ - bin/hue bin/reflink-snap +$ all:VB: $bins + +$ deploy-dir:VB: + install -d -m 700 $deploy_dir + +$ deploy/all:VB: deploy-dir $bins + install -m 755 $bins $deploy_dir/ + echo "deployed all tools to $deploy_dir" + +$ deploy/mpd:VB: deploy-dir $mpd_bins + install -m 755 $mpd_bins $deploy_dir/ + echo "deployed mpd tools to $deploy_dir" + +$ deploy/%:VB: deploy-dir bin/% + install -m 755 bin/$match $deploy_dir/ + echo "deployed $match to $deploy_dir" }