diff options
author | Bo Ørsted Andresen <bo.andresen@zlin.dk> | 2007-03-20 11:48:34 +0000 |
---|---|---|
committer | Bo Ørsted Andresen <bo.andresen@zlin.dk> | 2007-03-20 11:48:34 +0000 |
commit | 33f5a3d79e1c3b91d0a5a75555d2f3a56721b81a (patch) | |
tree | 1a61d96814a122d0a5f155f070b1786267155c77 | |
parent | 662cf702e6afc82f5a548e4e6e651454b2937a51 (diff) | |
download | wgetpaste-33f5a3d79e1c3b91d0a5a75555d2f3a56721b81a.tar.gz |
Get rid of header(), show_languages() and show_expiration_options(). show() is usable for all of them.
-rwxr-xr-x | wgetpaste | 28 |
1 files changed, 7 insertions, 21 deletions
@@ -143,23 +143,19 @@ usage() { ### show functions -header() { - [[ "${1}" == "Service" ]] || local BY="by $(get_recipient) " - echo "${1}s supported ${BY}(case sensitive):" -} - show() { + echo "${2}s supported by $(get_recipient) (case sensitive):" local nr extra nr="$(eval "echo \${#${ENGINE}_${1}[*]}")" - [[ "${2}" == expiration ]] && extra="$(eval "echo \${${SERVICE}[3]}")" - [[ ${nr} -eq 0 ]] && echo -e "\n${extra}\"${SERVICE}\" has no support for setting ${2}." 1>&2 + [[ "${3}" == expiration ]] && extra="$(eval "echo \${${SERVICE}[3]}")" + [[ ${nr} -eq 0 ]] && echo -e "\n${extra}\"${SERVICE}\" has no support for setting ${3}." 1>&2 for ((i=0; i<${nr}; i++)); do eval "echo \" \${${ENGINE}_${1}[i]}\"" - done + done | ${4:-cat} } show_services() { - header "Service" + echo "Services supported: (case sensitive):" local max arg IND INDV engine max=0 for arg in "${SERVICES[@]}"; do @@ -180,16 +176,6 @@ show_services() { done } -show_languages() { - header "Language" - show LANGUAGES language | sort -} - -show_expiration_options() { - header "Expiration option" - show EXPIRATIONS expiration -} - ### verify functions verify_service() { @@ -438,10 +424,10 @@ NICK="${NICK:-$(escape "${DEFAULT_NICK}")}" CVT_TABS="No" # show languages if requested (needs to be done after the right service is selected) -[[ ${LIST_LANGUAGES} ]] && show_languages && exit 0 +[[ ${LIST_LANGUAGES} ]] && show LANGUAGES Language language sort && exit 0 # show expiration options if requested (needs to be done after the right service is selected) -[[ ${LIST_EXPIRATION} ]] && show_expiration_options && exit 0 +[[ ${LIST_EXPIRATION} ]] && show EXPIRATIONS "Expiration option" expiration && exit 0 # language needs to be verified before it is escaped but after service is selected [[ -n "$(eval "echo \${DEFAULT_LANGUAGE_${SERVICE}}")" ]] && LANGUAGE="${LANGUAGE:-$(eval "echo \${DEFAULT_LANGUAGE_${SERVICE}}")}" |