From 9de1baa19718aa91098af7fd09f740179965ec0c Mon Sep 17 00:00:00 2001 From: Levi Neely Date: Sat, 18 Apr 2026 12:39:34 +0200 Subject: [PATCH] scripts: add b/cleanup; update docs and mkfile Co-Authored-By: Claude Sonnet 4.6 --- 9p | 2 +- mkfile | 1 + scripts/README.md | 11 +++++++++++ scripts/b/cleanup | 13 +++++++++++++ 4 files changed, 26 insertions(+), 1 deletion(-) create mode 100755 scripts/b/cleanup diff --git a/9p b/9p index 80b7d1a..237e4de 160000 --- a/9p +++ b/9p @@ -1 +1 @@ -Subproject commit 80b7d1aad6829c62de26be95bce96c9b1ba3d28c +Subproject commit 237e4dec8cdea67535cf5266d4d67b39b8ae37a7 diff --git a/mkfile b/mkfile index bd5f518..4c2b922 100755 --- a/mkfile +++ b/mkfile @@ -46,6 +46,7 @@ scripts:V: cp -f scripts/b/job $HOME/.config/ollie/scripts/b/job cp -f scripts/b/q $HOME/.config/ollie/scripts/b/q cp -f scripts/b/sched $HOME/.config/ollie/scripts/b/sched + cp -f scripts/b/cleanup $HOME/.config/ollie/scripts/b/cleanup cp -f scripts/u/optimize $HOME/.config/ollie/scripts/u/optimize chmod 755 $HOME/.config/ollie/scripts/u/optimize diff --git a/scripts/README.md b/scripts/README.md index 7dd6f86..6fba160 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -13,6 +13,7 @@ $OLLIE/s/kill # kill a session $OLLIE/b/job "my prompt" # submit and wait for a batch job $OLLIE/b/q "my prompt" # foreground one-shot query $OLLIE/b/sched "my prompt" # submit a background job; prints b/ path +$OLLIE/b/cleanup # remove all completed jobs $OLLIE/u/optimize "prompt" # generate and return best optimized prompt ``` @@ -138,6 +139,16 @@ echo "prompt" | b/q [flags] --- +## b/cleanup + +Remove all batch jobs with status `done`. + +``` +b/cleanup +``` + +--- + ## b/sched Submit a background job; prints the `b/` path for each job. Wrapper around diff --git a/scripts/b/cleanup b/scripts/b/cleanup new file mode 100755 index 0000000..d28ab4f --- /dev/null +++ b/scripts/b/cleanup @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +# b/cleanup: remove all batch jobs with status "done". +set -euo pipefail + +OLLIE=${OLLIE:-$HOME/mnt/ollie} + +for job in "$OLLIE"/b/*/; do + [ -d "$job" ] || continue + status=$(tr -d '[:space:]' < "$job/status" 2>/dev/null) || continue + case "$status" in + done*) rm -r "$job" ;; + esac +done