From 14f2107edf311477a7b22883f346bbfd786530bd Mon Sep 17 00:00:00 2001 From: Rezart Qelibari Date: Thu, 17 Feb 2022 12:47:32 +0100 Subject: [PATCH] Move showQuestions to lib.sh --- modules/01-system-settings.sh | 7 ++----- modules/lib.sh | 8 ++++++++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/modules/01-system-settings.sh b/modules/01-system-settings.sh index d597826..f7415ed 100755 --- a/modules/01-system-settings.sh +++ b/modules/01-system-settings.sh @@ -16,16 +16,13 @@ function checkPrerequisites() { checkCommands } -function showQuestions() { - local timezones questions question +function getQuestions() { + local timezones timezones="`systemsetup -listtimezones | tail -n +2 | awk '{print $1}' | paste -sd, -`" questions=( 'i: hostname=What shall the hostname of this host be?' 's: timezone=What shall the timezone of this host be? # choose from:'"${timezones};" ) - for question in ${questions}; do - hio info "${question}" - done } function quitSystemPreferences() { diff --git a/modules/lib.sh b/modules/lib.sh index 1afb518..ce46350 100644 --- a/modules/lib.sh +++ b/modules/lib.sh @@ -26,6 +26,14 @@ function checkCommands() { done } +function showQuestions() { + local questions=() + getQuestions + for question in ${questions}; do + hio info "${question}" + done +} + function module_main() { autoloadZShLib || return checkPrerequisites || return