From 5f036234d12e7bb4d01f151367ebe6315d0fbf59 Mon Sep 17 00:00:00 2001 From: hayao Date: Sat, 21 Nov 2020 09:24:40 +0900 Subject: [PATCH] [update] : Updated help display - Use echo_blank function - Use locale.sh to list of locales --- build.sh | 41 ++++++++++++++++++----------------------- 1 file changed, 18 insertions(+), 23 deletions(-) diff --git a/build.sh b/build.sh index 0a21f60..72946a3 100755 --- a/build.sh +++ b/build.sh @@ -176,6 +176,13 @@ remove() { done } +# Usage: echo_blank +# 指定されたぶんの半角空白文字を出力します +echo_blank(){ + local _blank + for _local in $(seq 1 "${1}"); do echo -ne " "; done +} + # Show help _usage () { echo "usage ${0} [options] [channel]" @@ -189,11 +196,11 @@ _usage () { echo " Default: ${locale_name}" echo " -m | --mirror Set apt mirror server." echo " Default: ${mirror}" - echo " -o | --out Set the output directory" + echo " -o | --out Set the output directory" echo " Default: ${out_dir}" - echo " -w | --work Set the working directory" + echo " -w | --work Set the working directory" echo " Default: ${work_dir}" - echo " -c | --cache Set the cache directory" + echo " -c | --cache Set the cache directory" echo " Default: ${cache_dir}" echo echo " -d | --debug Enable debug messages" @@ -202,44 +209,32 @@ _usage () { echo echo "You can switch between installed packages, files included in images, etc. by channel." echo + + local blank="23" _arch _list _dirname _channel + echo " Language for each architecture:" for _list in ${script_path}/system/locale-* ; do _arch="${_list#${script_path}/system/locale-}" echo -n " ${_arch}" - for i in $( seq 1 $(( ${blank} - 4 - ${#_arch} )) ); do - echo -ne " " - done - _locale_name_list=$(cat ${_list} | grep -h -v ^'#' | awk '{print $1}') - for _lang in ${_locale_name_list[@]};do - echo -n "${_lang} " - done - echo + echo_blank "$(( ${blank} - ${#_arch} ))" + "${script_path}/tools/locale.sh" -a "${_arch}" show done - echo " Channel:" - - local _channel - local channel_list - local description + echo -e "\n Channel:" + local _channel channel_list description for _channel in $(ls -l "${channels_dir}" | awk '$1 ~ /d/ {print $9 }'); do if [[ -n $(ls "${channels_dir}/${_channel}") ]] && [[ ! "${_channel}" = "share" ]]; then channel_list+=( "${_channel}" ) fi done - for _channel in ${channel_list[@]}; do if [[ -f "${channels_dir}/${_channel}/description.txt" ]]; then description=$(cat "${channels_dir}/${_channel}/description.txt") else description="This channel does not have a description.txt." fi - echo -ne " ${_channel}" - - for i in $( seq 1 $(( 23 - ${#_channel} )) ); do - echo -ne " " - done - + echo_blank "$(( ${blank} - ${#_channel} ))" echo -ne "${description}\n" done } -- 2.11.0