From 794973b5ee76d8f0c768c98fe75cde10a08aaf6d Mon Sep 17 00:00:00 2001 From: Thomas Levine <_@thomaslevine.com> Date: Sun, 28 Feb 2016 12:41:39 +0000 Subject: [PATCH] remove root prefix from paths --- urchin | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/urchin b/urchin index eda9ed5..46892a7 100755 --- a/urchin +++ b/urchin @@ -182,10 +182,13 @@ recurse() { } report_outcome() { - tap_format="$1" - log_file="$2" - start="$3" - finish="$4" + root="$1" + tap_format="$2" + log_file="$3" + start="$4" + finish="$5" + + escaped_root="$(fullpath "$root" | sed 's/\//\\\//g')" elapsed=$(($finish - $start)) # if "$tap_format"; then @@ -203,7 +206,7 @@ report_outcome() { sort "$log_file" > $sorted_log_file while read line; do regex='^\(.*\): \(ok\|skip\|not_ok\) \([0-9]*\) seconds$' - path=$(echo "$line" | sed "s/$regex/\1/") + path=$(echo "$line" | sed "s/$regex/\1/" | sed "s/$escaped_root\/\?//") result=$(echo "$line" | sed "s/$regex/\2/") file_elapsed=$(echo "$line" | sed "s/$regex/\3/") @@ -413,7 +416,7 @@ if basename "$(fullpath "$root")" | set -e finish=$(date +%s) - report_outcome true $tmp/log $start $finish + report_outcome "$root" true $tmp/log $start $finish urchin_exit $exit_code else