diff options
author | lonkaars <loek@pipeframe.xyz> | 2024-03-11 18:33:02 +0100 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2024-03-11 18:33:02 +0100 |
commit | e6c1cacb60010ec75e02cf72acf34278417670fd (patch) | |
tree | 97e8f8042f4d8461e7cec9f403787bad20ffde9e /core/lib |
initial commit (basic functionality)
Diffstat (limited to 'core/lib')
-rw-r--r-- | core/lib | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/core/lib b/core/lib new file mode 100644 index 0000000..9892663 --- /dev/null +++ b/core/lib @@ -0,0 +1,18 @@ +#!/bin/sh +# utility variables and functions +XDG_CACHE_HOME="${XDG_CACHE_HOME:-$HOME/.cache}" # XDG basedir specification + +# this variable grows automatically as long as this file is included in each +# subcommand +export subcmd="$subcmd${subcmd:+ }$(basename "$0")" + +# print an error to stdout and exit +err() { + echo "error: $*" >&2 + echo "run \`$subcmd --help\` for options" >&2 + exit 1 +} + +# debug: +# bc() { tee /dev/stderr | /usr/bin/bc ; } + |