diff --git a/reporters/trending.sh b/reporters/trending.sh index 91936af..6b1442d 100755 --- a/reporters/trending.sh +++ b/reporters/trending.sh @@ -64,13 +64,11 @@ if [ ${#TARGET_FILES[@]} -eq 0 ]; then exit 0 fi -# Use awk to process the tsv files +# Use awk to process the tsv files, then sort the results awk ' BEGIN { FS="\t"; OFS="\t"; - print "Change\tLast Value\tFirst Value\tMetrics"; - print "------\t----------\t-----------\t-------"; } FNR == 1 { next; } # Skip header row of each file { @@ -104,4 +102,9 @@ END { print change_str, last_value[metric], first_value[metric], metric; } } -}' "${TARGET_FILES[@]}" +}' "${TARGET_FILES[@]}" | +( + echo -e "Change\tLast\tFirst\tmodule\tchannels\tnamespace" + echo -e "------\t----\t-----\t------\t--------\t---------" + sort -k1,1nr +) diff --git a/test/dashboard.bats b/test/dashboard.bats index eadd9f7..72977de 100644 --- a/test/dashboard.bats +++ b/test/dashboard.bats @@ -18,7 +18,7 @@ EOL teardown() { # This teardown function is run after each test. - rm -rf config + rm -f config/config.sh } @test "dashboard.sh should be executable" { diff --git a/test/discord.bats b/test/discord.bats index 9a11c5a..da704b8 100644 --- a/test/discord.bats +++ b/test/discord.bats @@ -23,7 +23,7 @@ EOF teardown() { # This teardown function is run after each test. - rm -rf config + rm -f config/config.sh rm -rf "/tmp/bats_mocks_$$" } diff --git a/test/github.bats b/test/github.bats index 0e6374a..bd0cd49 100644 --- a/test/github.bats +++ b/test/github.bats @@ -14,7 +14,7 @@ EOL teardown() { # This teardown function is run after each test. - rm -rf config + rm -f config/config.sh } @test "github module produces valid tsv" { diff --git a/test/hackernews.bats b/test/hackernews.bats index 0df7ec5..e961981 100644 --- a/test/hackernews.bats +++ b/test/hackernews.bats @@ -13,7 +13,7 @@ EOL teardown() { # This teardown function is run after each test. - rm -rf config + rm -f config/config.sh } @test "hackernews module produces valid tsv" {