From 2caa74232abbc55dc3f07e8fe7f27cb530a45ae4 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Thu, 25 Jan 2024 00:11:51 +0000 Subject: [PATCH] Add `run` file with a `build` task --- flake.nix | 1 + run | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100755 run diff --git a/flake.nix b/flake.nix index 72c2af5..0fd26fc 100644 --- a/flake.nix +++ b/flake.nix @@ -13,6 +13,7 @@ rm $out/.envrc rm $out/flake.lock rm $out/flake.nix + rm $out/run rm $out/stylua.toml ''; src = ./.; diff --git a/run b/run new file mode 100755 index 0000000..839d89b --- /dev/null +++ b/run @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +set -o nounset +set -o pipefail + +function build { + nix build --json --no-link --print-build-logs ".#${1:-default}" +} + +function help { + printf "%s [args]\n\nTasks:\n" "${0}" + + compgen -A function | grep -v "^_" | cat -n + + printf "\nExtended help:\n Each task has comments for general usage\n" +} + +TIMEFORMAT="Task completed in %3lR" +time "${@:-help}"