mk: make main() more readable

now that main is so small, some of the condensed
lines can be loosened up.

Signed-off-by: Leah Rowe <leah@libreboot.org>
25.04_branch
Leah Rowe 2025-04-26 22:46:30 +01:00
parent f3caaf394e
commit 76d99b8cae
1 changed files with 13 additions and 5 deletions

18
mk
View File

@ -20,13 +20,21 @@ eval "`setvars "" vdir src_dirname srcdir mode`"
main()
{
cmd="" && [ $# -gt 0 ] && cmd="$1" && shift 1
cmd=""
if [ $# -gt 0 ]; then
cmd="$1"
shift 1
fi
case "$cmd" in
version) printf "%s\nWebsite: %s\n" "$relname" "$projectsite" ;;
release|inject) $cmd "$@" ;;
-*) return 1 ;;
*) $err "bad command" ;;
version)
printf "%s\nWebsite: %s\n" "$relname" "$projectsite" ;;
release|inject)
$cmd "$@" ;;
-*)
return 1 ;;
*)
$err "bad command" ;;
esac
set -u -e # some commands disable them. turn them on!
}