diff --git a/README.md b/README.md index 0628703..71ba5d9 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ Tool that helps working with URIs on the command line, processing parts or prepa [![license](https://img.shields.io/github/license/adrianrudnik/uritool.svg)](https://lab.klonmaschine.de/adrian.rudnik/uritool/blob/develop/LICENSE) [![pipeline status](https://lab.klonmaschine.de/adrian.rudnik/uritool/badges/develop/pipeline.svg)](https://lab.klonmaschine.de/adrian.rudnik/uritool/commits/develop) [![coverage report](https://lab.klonmaschine.de/adrian.rudnik/uritool/badges/develop/coverage.svg)](https://lab.klonmaschine.de/adrian.rudnik/uritool/commits/develop) +[![go report card](https://goreportcard.com/badge/github.com/adrianrudnik/uritool)](https://goreportcard.com/report/github.com/adrianrudnik/uritool) ## Installation diff --git a/cmd/cmdtest/utils.go b/cmd/cmdtest/utils.go index f39041b..48588f7 100644 --- a/cmd/cmdtest/utils.go +++ b/cmd/cmdtest/utils.go @@ -5,11 +5,13 @@ import ( "github.com/spf13/cobra" ) +// ExecuteCommand executes and captures the output, returning the output and error func ExecuteCommand(root *cobra.Command, args ...string) (output string, err error) { _, output, err = ExecuteCommandC(root, args...) return output, err } +// ExecuteCommand executes and captures the output, returning the used command and output and error func ExecuteCommandC(root *cobra.Command, args ...string) (c *cobra.Command, output string, err error) { buf := new(bytes.Buffer) root.SetOutput(buf) diff --git a/cmd/parse.go b/cmd/parse.go index 385bed9..6f42f4b 100644 --- a/cmd/parse.go +++ b/cmd/parse.go @@ -80,11 +80,7 @@ var parseUriCmd = &cobra.Command{ return nil } - if err := doJson(cmd, wrapped); err != nil { - return err - } - - return nil + return doJson(cmd, wrapped) }, } @@ -112,10 +108,6 @@ var parseQueryCmd = &cobra.Command{ return nil } - if err := doJson(cmd, parsed); err != nil { - return err - } - - return nil + return doJson(cmd, parsed) }, }