Move checkCommands to zshlib

This commit is contained in:
Rezart Qelibari
2022-04-22 06:52:01 +02:00
parent 5be8a9c13d
commit bc27890c08
2 changed files with 4 additions and 16 deletions

View File

@@ -40,22 +40,10 @@ function ensurePathOrLogError() {
} }
} }
function checkCommands() {
local cmd
for cmd in ${(k)cmds}; do
if ! which "${cmd}" >&! /dev/null; then
local comment=''
[ -n "${cmds[$cmd]}" ] && comment=" ${cmds[$cmd]}"
lop -- -e "This module needs ${cmd}${comment} to work."
return 11
fi
done
}
function checkHelpPrerequisites() { function checkHelpPrerequisites() {
local -A cmds local -A cmds
getHelpPrerequisites || return getHelpPrerequisites || return
checkCommands checkCommands ${(k)cmds}
} }
function addDocoptsToCmds() { function addDocoptsToCmds() {
@@ -73,13 +61,13 @@ whence getHelpPrerequisites >&! /dev/null || function $_() {
function checkQuestionsPrerequisites() { function checkQuestionsPrerequisites() {
local -A cmds local -A cmds
getQuestionsPrerequisites || return getQuestionsPrerequisites || return
checkCommands checkCommands ${(k)cmds}
} }
function checkExecPrerequisites() { function checkExecPrerequisites() {
local -A cmds local -A cmds
getExecPrerequisites || return getExecPrerequisites || return
checkCommands checkCommands ${(k)cmds}
} }
function showQuestions() { function showQuestions() {

2
zshlib

Submodule zshlib updated: a20db501bd...174bc62804