From 7dc70982e5e5dda23adf6e889b725e0c86ec5eca Mon Sep 17 00:00:00 2001 From: Thomas Levine <_@thomaslevine.com> Date: Sun, 10 Apr 2016 18:51:52 +0000 Subject: [PATCH] shorter outcome printing --- urchin | 41 +++++++++++++++++------------------------ 1 file changed, 17 insertions(+), 24 deletions(-) diff --git a/urchin b/urchin index 8064ec7..e82456d 100755 --- a/urchin +++ b/urchin @@ -378,36 +378,29 @@ format_urchin() { currentdir="$(dirname -- "${path}")" prevdir="${currentdir}" + if test -z "${the_shell}"; then + message="${the_shell} on ${remote} is not executable." + else + unit="$(plural second "${file_elapsed}")" + message="${the_shell} on ${remote} (${file_elapsed} ${unit})" + fi case "${result}" in - ok) - if "${print_ok}"; then - header - printf "${success_mark} " - echo "${the_shell} ("${file_elapsed}" $(plural second $file_elapsed))" - fi - ;; - not_ok) - if "${print_not_ok}"; then - header - printf "${fail_mark} " - echo "${the_shell} ("${file_elapsed}" $(plural second $file_elapsed))" - fi - ;; - skip) - if "${print_ok}"; then - header - if test -z "${the_shell}"; then - echo ' (Specified shell is not executable.)' - else - echo " ${the_shell} ("${file_elapsed}" $(plural second $file_elapsed))" - fi - fi - ;; + ok) if "${print_ok}"; then + header && echo "${success_mark} ${message}" + fi ;; + not_ok) if "${print_not_ok}"; then + header && echo "${fail_mark} ${message}" + fi ;; + skip) if "${print_ok}"; then + header && echo "${skip_mark} ${message}" + fi ;; esac + if { test "${result}" = not_ok && "${print_not_ok_stdout}"; } || { test "${result}" = ok && "${print_ok_stdout}"; }; then sed 's/^/ | /' "$(stdout_file "${path}" "${the_shell}")" fi + prevpath="${path}" done