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>
This commit is contained in:
Leah Rowe
2024-06-03 00:17:36 +01:00
parent afac9a06d2
commit 00653aab1e
4 changed files with 17 additions and 8 deletions
+9
View File
@@ -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