Add possiblity to check only runtime dependencies
This commit is contained in:
@@ -29,10 +29,11 @@ function getModuleAnswerByKeyRegEx() {
|
|||||||
|
|
||||||
function checkCommands() {
|
function checkCommands() {
|
||||||
local cmd
|
local cmd
|
||||||
for cmd in ${(k)cmds}; do
|
local varName=$1
|
||||||
|
for cmd in ${(Pk)varName}; do
|
||||||
if ! which "${cmd}" >&! /dev/null; then
|
if ! which "${cmd}" >&! /dev/null; then
|
||||||
local comment=''
|
local comment=''
|
||||||
[ -n "${cmds[$cmd]}" ] && comment=" ${cmds[$cmd]}"
|
[ -n "${${(P)varName}[$cmd]}" ] && comment=" ${${(P)varName}[$cmd]}"
|
||||||
lop -- -e "This module needs ${cmd}${comment} to work."
|
lop -- -e "This module needs ${cmd}${comment} to work."
|
||||||
return 11
|
return 11
|
||||||
fi
|
fi
|
||||||
@@ -51,10 +52,11 @@ function module_main() {
|
|||||||
local cmdName=${1:t}
|
local cmdName=${1:t}
|
||||||
shift
|
shift
|
||||||
autoloadZShLib || return
|
autoloadZShLib || return
|
||||||
checkPrerequisites || return
|
checkPrerequisites cmds || return
|
||||||
configureLogging
|
configureLogging
|
||||||
eval "`getUsage $cmdName | docopts -f -V - -h - : "$@"`"
|
eval "`getUsage $cmdName | docopts -f -V - -h - : "$@"`"
|
||||||
[ $# -lt 1 ] && return
|
[ $# -lt 1 ] && return
|
||||||
[ "${show_questions}" = true ] && { showQuestions; return }
|
[ "${show_questions}" = true ] && { showQuestions; return }
|
||||||
|
checkPrerequisites execCmds || return
|
||||||
configure_system
|
configure_system
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user