Use argName instead of optionName for module args

This commit is contained in:
T. R. Bernstein
2024-06-28 01:18:53 +02:00
committed by T. R. Bernstein
parent f568cc6dbd
commit 4d9805581c
2 changed files with 6 additions and 5 deletions

View File

@@ -27,17 +27,18 @@ function printModulesToInstall() {
}
function generateModuleOptions() {
local value answerKey optionKey
local value answerKey optionKey argName
for answerKey in ${(k)moduleAnswers}; do
[[ ${answerKey} = ${mod}_* ]] || continue
optionKey="${answerKey#${mod}_}"
argName=${optionKey//_/-};
value="${moduleAnswers[${answerKey}]}"
if [[ "${optionKey}" =~ ^[[:alpha:]]$ ]]; then
moduleOptions+=("-${optionKey}" "${value}")
moduleOptions+=("-${argName}" "${value}")
elif [[ "${optionKey}" =~ ^[[:alpha:]][-[:alpha:]]+$ ]]; then
moduleOptions+=("--${optionKey}" "${value}")
moduleOptions+=("--${argName}" "${value}")
else
moduleOptions+=("${optionKey}" "${value}")
moduleOptions+=("${argName}" "${value}")
fi
done
}