diff options
author | Leah Rowe <leah@libreboot.org> | 2024-06-03 00:17:36 +0100 |
---|---|---|
committer | Leah Rowe <leah@libreboot.org> | 2024-06-03 00:17:36 +0100 |
commit | 00653aab1ea6d1bc227227da9e2195432f8fe52e (patch) | |
tree | c5af83eab50fdc1186597b2b8f3974c4f6dd456b /include | |
parent | afac9a06d2c6f18c44066321674129383e85b2ba (diff) |
better help text on invalid commands
adding help again is a bad idea. code should never
document itself; that's what documentation is for.
so, make the code do a better job telling the user
where to find documentation.
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'include')
-rwxr-xr-x | include/lib.sh | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/lib.sh b/include/lib.sh index 1b0f07c1..8d4b7825 100755 --- a/include/lib.sh +++ b/include/lib.sh @@ -15,6 +15,15 @@ tmpgit="$PWD/tmp/gitclone" grubdata="config/data/grub" err="err_" +badcmd() +{ + errmsg="no context given" + [ $# -gt 0 ] && errmsg="$1" + + dstr="Check $projectname docs via $projectsite" + [ -d "docs" ] && dstr="$dstr (local docs available via docs/)" + $err "Bad command ($errmsg). $dstr" +} err_() { printf "ERROR %s: %s\n" "$0" "$1" 1>&2 |