From 9c162a8d9afba45b869bba371f11db383bf2ec9e Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Tue, 2 Jan 2024 22:00:57 -0600 Subject: Removed first version --- ok1 | 99 --------------------------------------------------------------------- 1 file changed, 99 deletions(-) delete mode 100755 ok1 (limited to 'ok1') diff --git a/ok1 b/ok1 deleted file mode 100755 index 9d7971c..0000000 --- a/ok1 +++ /dev/null @@ -1,99 +0,0 @@ -#!/bin/sh -## ok: a minimal command runner and build tool -# by Case Duckworth -- released to the public domain - -QUIET=false -NORUN=false -FBUILD=false -OKFILE=./ok -FRFILE=.fr - -_usage() { - exec >&2 - cat<&2 '* %s\n' "$*" - $NORUN || "$@" || exit $((100 + $?)) -} - -quietly() { "$@" >/dev/null 2>&1; } - -frun() { - cut -f2- <"$FRFILE" | - while read -r line - do eval "$line" - done -} - -fr() { # fr < GOAL JOB DEPS... - # recommended: use a heredoc - :>"$FRFILE" - while read -r goal job deps - do - eval set -- "$deps" - if buildp "$goal" "$@" - then - printf '%s\t%s %s\n' \ - "$goal" \ - "$job" "$(echo "$deps"|sed 's/--.*//')" \ - >>"$FRFILE" - fi - done -} - -while getopts hqnxBf:C: OPT -do - case "$OPT" in - (h) _usage ;; - (q) QUIET=true ;; - (x) set -x ;; - (n) NORUN=true ;; - (B) FBUILD=true ;; - (f) OKFILE="$OPTARG" ;; - (C) cd "$OPTARG" || exit 2 ;; - (*) _usage 1 ;; - esac -done -shift $((OPTIND - 1)) - -. "$OKFILE" || exit 3 - -test -z "$1" && default -for target -do - if grep -q "$target" "$FRFILE" - then eval "$(grep "$target" "$FRFILE" | cut -f2-)" - else "$target" - fi -done -- cgit 1.4.1-21-gabe81