diff options
author | Bo Ørsted Andresen <bo.andresen@zlin.dk> | 2007-03-20 10:12:12 +0000 |
---|---|---|
committer | Bo Ørsted Andresen <bo.andresen@zlin.dk> | 2007-03-20 10:12:12 +0000 |
commit | 40a52500c0223922a23d477380d462128e1dc0d3 (patch) | |
tree | 16d045a35a484ba4d55d3842ec24baeec12a75db | |
parent | 580542440516c30b88b689240c63141232a6f267 (diff) | |
download | wgetpaste-40a52500c0223922a23d477380d462128e1dc0d3.tar.gz |
Fix --list-services. Add support for showing the engine of each service with --list-services --verbose.
-rwxr-xr-x | wgetpaste | 20 |
1 files changed, 17 insertions, 3 deletions
@@ -174,13 +174,23 @@ verify() { show_services() { header "Service" - local max=0 + local max arg s IND INDV engine + max=0 for arg in "${SERVICES[@]}"; do [[ ${#arg} -gt ${max} ]] && max=${#arg} done ((IND=6+${max})) + if ${VERBOSE}; then + max=0 + for s in "${SERVICES[@]}"; do + arg=$(eval "echo \${${s}[1]}") + [[ ${#arg} -gt ${max} ]] && max=${#arg} + done + ((INDV=3+${max}+${IND})) + fi for ((i=0; i<${#SERVICES[*]}; i++)); do - eval "echo -e \" ${SERVICES[i]} \e[${IND}G- \${${SERVICES[i]}[0]}\"" + [[ ${VERBOSE} ]] && eval "engine=$'\e'\"[${INDV}G- \${${SERVICES[i]}[0]}\"" + eval "echo -e \" ${SERVICES[i]} \e[${IND}G- \${${SERVICES[i]}[1]}${engine}\"" done } @@ -384,7 +394,8 @@ while [[ -n "${1}" ]]; do shift 2 ;; -S | --list-services ) - show_services && exit 0 + SHOW_SERVICES=true + shift ;; -v | --verbose ) VERBOSE=true @@ -408,6 +419,9 @@ done ### everything below this should be independent of which service is being used... +# show services if requested (need to respect --verbose if specified) +[[ ${SHOW_SERVICES} ]] && show_services && exit 0 + # set default service, nick, source and tabs convertion SERVICE="${SERVICE:-${DEFAULT_SERVICE}}" ENGINE="$(eval "echo \${${SERVICE}[0]}")" |