Skip to content

Commit

Permalink
allow multiple commands and remove start end bs
Browse files Browse the repository at this point in the history
  • Loading branch information
shravanasati committed Jan 6, 2024
1 parent 9341b23 commit e6ff8b3
Show file tree
Hide file tree
Showing 4 changed files with 140 additions and 152 deletions.
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ go 1.21

require (
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510
github.com/thatisuday/commando v1.0.4
golang.org/x/mod v0.14.0
)

require (
github.com/Shravan-1908/clapper v0.0.0-20240106171030-4cb053440d78 // indirect
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db // indirect
github.com/rivo/uniseg v0.4.4 // indirect
golang.org/x/sys v0.14.0 // indirect
golang.org/x/term v0.14.0 // indirect
)

require (
github.com/schollz/progressbar/v3 v3.14.1
github.com/thatisuday/clapper v1.0.10 // indirect
github.com/Shravan-1908/commando v1.0.5-0.20240106171728-b783c987b625
github.com/schollz/progressbar/v3 v3.14.1
)
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
github.com/Shravan-1908/clapper v0.0.0-20240106171030-4cb053440d78 h1:PI9osiOlyzDJKGXb2y5ReUibS0Q3nmQXfFazIBI6J8o=
github.com/Shravan-1908/clapper v0.0.0-20240106171030-4cb053440d78/go.mod h1:W8tuIEfOF1qT+reqUGdaqGjhnlh155+9faH65cpfuiw=
github.com/Shravan-1908/commando v1.0.5-0.20240106171728-b783c987b625 h1:5w+9J0Cu5p2OuccIgCZX8xLw6pI++V55XfCxDLXkvaY=
github.com/Shravan-1908/commando v1.0.5-0.20240106171728-b783c987b625/go.mod h1:fLVEV2Opf40U79WuVmjQwTaHIup/oyclpiKpFGHXzSA=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand All @@ -16,10 +20,6 @@ github.com/schollz/progressbar/v3 v3.14.1/go.mod h1:Zc9xXneTzWXF81TGoqL71u0sBPjU
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/thatisuday/clapper v1.0.10 h1:1EkqE/nb4npp8DuTKnpvVzO/Mcac9lOPND34uUKF+bU=
github.com/thatisuday/clapper v1.0.10/go.mod h1:FQGIg8q2uzeI+3SUS82YKF4E3KexkHStbiK4qTfDknM=
github.com/thatisuday/commando v1.0.4 h1:aNdH9tvmx2EPG6rT3NTQOV/qFYPf4Ap4Spo+q+n9Ois=
github.com/thatisuday/commando v1.0.4/go.mod h1:ODGz6jwJs4QqhLJtCjRRs8xIrmLLMdatYYddP+v1b4E=
golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0=
golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
Expand Down
12 changes: 2 additions & 10 deletions internal/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ import (
// Other numerical quantities except iterations are represented as strings because they are
// durations, and time.Duration offers a .String() method.
type Result struct {
Started string
Ended string
Command string
Iterations int
Average string
Expand All @@ -28,8 +26,6 @@ var summaryNoColor = `
Benchmarking Summary
--------------------
Started: {{ .Started }}
Ended: {{ .Ended }}
Executed Command: {{ .Command }}
Total iterations: {{ .Iterations }}
Average time taken: {{ .Average }} ± {{ .StandardDeviation }}
Expand All @@ -40,8 +36,6 @@ var summaryColor = `
${blue}Benchmarking Summary ${reset}
${blue}-------------------- ${reset}
${yellow}Started: ${green}{{ .Started }} ${reset}
${yellow}Ended: ${green}{{ .Ended }} ${reset}
${yellow}Executed Command: ${green}{{ .Command }} ${reset}
${yellow}Total iterations: ${green}{{ .Iterations }} ${reset}
${yellow}Average time taken: ${green}{{ .Average }} ± {{ .StandardDeviation }} ${reset}
Expand Down Expand Up @@ -102,8 +96,6 @@ func markdownify(r *Result) {
| Fields | Values |
| ----------- | ----------- |
| Started | {{.Started}} |
| Ended | {{.Ended}} |
| Executed Command | {{.Command}} |
| Total iterations | {{.Iterations}} |
| Average time taken | {{.Average}} ± {{ .StandardDeviation }} |
Expand Down Expand Up @@ -140,8 +132,8 @@ func jsonify(r *Result) ([]byte, error) {
// csvify converts the Result struct to CSV.
func csvify(r *Result) {
text := `
Started,Ended,Executed Command,Total iterations,Average time taken,Range
{{.Started}}, {{.Ended}}, {{.Command}}, {{.Iterations}}, {{.Average}} ± {{ .StandardDeviation }}, {{.Min}} ... {{.Max}}
Executed Command,Total iterations,Average time taken,Range
{{.Command}}, {{.Iterations}}, {{.Average}} ± {{ .StandardDeviation }}, {{.Min}} ... {{.Max}}
`
tmpl, err := template.New("summary").Parse(text)
if err != nil {
Expand Down
Loading

0 comments on commit e6ff8b3

Please sign in to comment.