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