1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
#!/usr/bin/env bash
LIST="@KCFG_LIST@"
main() {
local kcfg="${1}"; shift
local k
case "${kcfg}" in
"") error "what should I do (see -h)?\n";;
-h|--help) help; exit 0;;
-*) error "no such option '%s'\n" "${kcfg}";;
esac
for k in ${LIST}; do
if [ "${kcfg}" = "${k}" ]; then
exec kconfig-${kcfg} "${@}"
error "cannot execute tool '%s'\n" "${kcfg}"
fi
done
error "no such tool '%s'\n" "${kcfg}"
}
help() {
cat <<-_EOF_
NAME
kconfig - meta-frontend to kconfig tools
SYNOPSIS
kconfig -h|--help
kconfig <kconfig-tool> [option ...]
DESCRIPTION
kconfig is the meta-frontend to all other kconfig tools:
${LIST}
The acceptable options depend on what tool is being called.
_EOF_
}
error() {
local fmt="${1}"; shift
printf "kconfig: ${fmt}" "${@}" >&2
exit 1
}
main "${@}"
|