Skip to content

Commit

Permalink
Fix with --pretty option
Browse files Browse the repository at this point in the history
  • Loading branch information
ko1nksm committed Mar 20, 2020
1 parent 6d595ea commit fe10b3c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
14 changes: 9 additions & 5 deletions shellmetrics
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ test || eval "__() { :; }"

set -eu

VERSION=0.4.1
VERSION=0.4.3

usage() {
cat<<HERE
Expand Down Expand Up @@ -392,19 +392,23 @@ title() {
echo
}

passthrough() {
cat
}

init_mode() {
case $1 in
default) proxy report default_report ;;
csv) proxy report csv_report ;;
debug)
proxy analyze title
proxy report cat
proxy report passthrough
;;
pretty)
proxy analyze title
proxy report cat
proxy parse cat
proxy peel cat
proxy report passthrough
proxy parse passthrough
proxy peel passthrough
;;
esac
}
Expand Down
10 changes: 5 additions & 5 deletions spec/shellmetrics_spec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ Describe "init_mode()"
default_report() { echo "default_report"; }
csv_report() { echo "csv_report"; }
title() { echo "title"; }
cat() { echo "cat"; }
cat() { echo "cat $#"; }

It "initializes as default mode"
When call init_mode "default"
Expand All @@ -490,15 +490,15 @@ Describe "init_mode()"
It "initializes as debug mode"
When call init_mode "debug"
The result of "analyze()" should eq "title"
The result of "report()" should eq "cat"
The result of "report()" should eq "cat 0"
End

It "initializes as pretty mode"
When call init_mode "pretty"
The result of "analyze()" should eq "title"
The result of "report()" should eq "cat"
The result of "parse()" should eq "cat"
The result of "peel()" should eq "cat"
The result of "report()" should eq "cat 0"
The result of "parse()" should eq "cat 0"
The result of "peel()" should eq "cat 0"
End
End

Expand Down

0 comments on commit fe10b3c

Please sign in to comment.