Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
candy12t committed Nov 23, 2022
1 parent b5880e2 commit 846d260
Show file tree
Hide file tree
Showing 25 changed files with 369 additions and 436 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
go install:

```shell
go install github.com/candy12t/deepl-cli/cmd/deepl-cli@v0.3.0
go install github.com/candy12t/deepl-cli/cmd/deepl-cli@v0.4.0
```

## setup
Expand Down
4 changes: 2 additions & 2 deletions cmd/deepl-cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

func main() {
conf := config.NewDeepLCLIConfig()
cli := cmd.NewCLI(os.Stdin, os.Stdout, os.Stderr, conf)
code := cli.Run(os.Args)
cli := cmd.NewCLI(os.Stdin, os.Stdout, os.Stderr)
code := cli.Run(os.Args, conf)
os.Exit(int(code))
}
12 changes: 11 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module github.com/candy12t/deepl-cli
go 1.17

require (
github.com/AlecAivazis/survey/v2 v2.3.6
github.com/golang/mock v1.6.0
github.com/stretchr/testify v1.7.1
github.com/urfave/cli/v2 v2.3.0
Expand All @@ -11,8 +12,17 @@ require (

require (
github.com/cpuguy83/go-md2man/v2 v2.0.1 // indirect
github.com/davecgh/go-spew v1.1.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
github.com/kr/pretty v0.1.0 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.16 // indirect
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
golang.org/x/sys v0.2.0 // indirect
golang.org/x/term v0.0.0-20210503060354-a79de5458b56 // indirect
golang.org/x/text v0.3.3 // indirect
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect
)
39 changes: 37 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,18 +1,44 @@
github.com/AlecAivazis/survey/v2 v2.3.6 h1:NvTuVHISgTHEHeBFqt6BHOe4Ny/NwGZr7w+F8S9ziyw=
github.com/AlecAivazis/survey/v2 v2.3.6/go.mod h1:4AuI9b7RjAR+G7v9+C4YSlX/YL3K3cWNXgWXOhllqvI=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2 h1:+vx7roKuyA63nhn5WAunQHLTznkw5W8b1Xc0dNjp83s=
github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2/go.mod h1:HBCaDeC1lPdgDeDbhX8XFpy1jqjK0IBG8W5K+xYqA0w=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/cpuguy83/go-md2man/v2 v2.0.1 h1:r/myEWzV9lfsM1tFLgDyu0atFtJ1fXn261LKYj/3DxU=
github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/creack/pty v1.1.17 h1:QeVUsEDNrLBW4tMgZHvxy18sKtr6VI492kBhUfhDJNI=
github.com/creack/pty v1.1.17/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4=
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=
github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc=
github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs=
github.com/hinshun/vt10x v0.0.0-20220119200601-820417d04eec h1:qv2VnGeEQHchGaZ/u7lxST/RaJw+cv273q79D81Xbog=
github.com/hinshun/vt10x v0.0.0-20220119200601-820417d04eec/go.mod h1:Q48J4R4DvxnHolD5P8pOtXigYlRuPLGl6moFx3ulM68=
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs=
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE=
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d h1:5PJl274Y63IEHC+7izoQE9x6ikvDFZS2mDVS3drnohI=
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/urfave/cli/v2 v2.3.0 h1:qph92Y649prgesehzOrQjdWyxFOp/QVM+6imKHad91M=
Expand All @@ -27,21 +53,30 @@ golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96b
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220422013727-9388b58f7150/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.2.0 h1:ljd4t30dBnAvMZaQCevtY0xLLD0A+bRZXbgLMLU1F/A=
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210503060354-a79de5458b56 h1:b8jxX3zqjpqb2LklXPzKSGJhzyxCOZSz8ncv8Nv+y7w=
golang.org/x/term v0.0.0-20210503060354-a79de5458b56/go.mod h1:tfny5GFUkzUvx4ps4ajbZsCe5lw1metzhBm9T3x7oIY=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
Expand Down
14 changes: 14 additions & 0 deletions internal/cmd/configure.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package cmd

import (
"github.com/candy12t/deepl-cli/internal/controller"
"github.com/urfave/cli/v2"
)

func NewCmdConfigure() *cli.Command {
return &cli.Command{
Name: "configure",
Usage: "Configure deepl-cli options.",
Action: controller.ConfigureAction,
}
}
31 changes: 31 additions & 0 deletions internal/cmd/repl.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package cmd

import (
"github.com/candy12t/deepl-cli/internal/config"
"github.com/candy12t/deepl-cli/internal/controller"
"github.com/candy12t/deepl-cli/internal/deepl"
"github.com/urfave/cli/v2"
)

func NewCmdRepl(conf *config.DeepLCLIConfig) *cli.Command {
client := deepl.NewClient(conf.Credential.DeepLAuthKey)

return &cli.Command{
Name: "repl",
Usage: "Translate with REPL.",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "source",
Aliases: []string{"s"},
Value: conf.DefaultLanguage.Source,
},
&cli.StringFlag{
Name: "target",
Aliases: []string{"t"},
Value: conf.DefaultLanguage.Target,
},
},
Before: CheckAuthKeyAction(conf.Credential.DeepLAuthKey),
Action: controller.ReplAction(client),
}
}
106 changes: 30 additions & 76 deletions internal/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@ import (
"io"

"github.com/candy12t/deepl-cli/internal/build"
"github.com/candy12t/deepl-cli/internal/cmd/subcmd/setup"
"github.com/candy12t/deepl-cli/internal/config"
"github.com/candy12t/deepl-cli/internal/controller"
"github.com/candy12t/deepl-cli/internal/deepl"
"github.com/candy12t/deepl-cli/internal/usecase"
"github.com/urfave/cli/v2"
)

Expand All @@ -21,104 +17,62 @@ const (
)

type CLI struct {
InStream io.Reader
OutStream io.Writer
ErrStream io.Writer
conf *config.DeepLCLIConfig
Reader io.Reader
Writer io.Writer
ErrWriter io.Writer
}

func NewCLI(inStream io.Reader, outStream, errStream io.Writer, conf *config.DeepLCLIConfig) *CLI {
func NewCLI(reader io.Reader, writer, errWriter io.Writer) *CLI {
return &CLI{
InStream: inStream,
OutStream: outStream,
ErrStream: errStream,
conf: conf,
Reader: reader,
Writer: writer,
ErrWriter: errWriter,
}
}

func (c *CLI) Run(args []string) exitCode {
var sourceLang, targetLang string
defaultSourceLanguage, defaultTargetLanguage := c.conf.DefaultLanguage.SourceLanguage, c.conf.DefaultLanguage.TargetLanguage

func (c *CLI) Run(args []string, conf *config.DeepLCLIConfig) exitCode {
cli.VersionFlag = &cli.BoolFlag{
Name: "version",
Aliases: []string{"v"},
Usage: "show deepl-cli version",
}

cli.HelpFlag = &cli.BoolFlag{
Name: "help",
Aliases: []string{"h"},
Usage: "Show help for command",
}

app := &cli.App{
Name: "deepl-cli",
Usage: "unofficial DeepL command line tool",
Version: build.Version,
Reader: c.InStream,
Writer: c.OutStream,
ErrWriter: c.ErrStream,
EnableBashCompletion: true,
HideHelp: true,
Flags: []cli.Flag{
&cli.BoolFlag{
Name: "help",
Aliases: []string{"h"},
Usage: "Show help for command",
},
},
Name: "deepl-cli",
Usage: "unofficial DeepL command line tool.",
Version: build.Version,
Reader: c.Reader,
Writer: c.Writer,
ErrWriter: c.ErrWriter,
HideHelpCommand: true,
CommandNotFound: func(ctx *cli.Context, command string) {
fmt.Fprintf(ctx.App.Writer, "unknown command %q for %q\n", command, "deepl-cli")
},
Commands: []*cli.Command{
{
Name: "setup",
Usage: "Setup for using this cli",
Action: func(ctx *cli.Context) error {
err := setup.Setup(ctx.App.Reader, ctx.App.Writer)
if err != nil {
return err
}
return nil
},
},
{
Name: "repl",
Usage: "Translate with REPL",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "source",
Aliases: []string{"s"},
Value: defaultSourceLanguage,
Destination: &sourceLang,
},
&cli.StringFlag{
Name: "target",
Aliases: []string{"t"},
Value: defaultTargetLanguage,
Destination: &targetLang,
},
},
Action: func(ctx *cli.Context) error {
if err := c.checkAuthKey(); err != nil {
return err
}
deeplCli := deepl.NewClient(c.conf.Auth.AuthKey)
uc := usecase.NewTranslation(deeplCli)
replCtrl := controller.NewRepl(uc, sourceLang, targetLang, ctx.App.Reader, ctx.App.Writer)
replCtrl.Apply()
return nil
},
},
NewCmdRepl(conf),
NewCmdConfigure(),
},
}

if err := app.Run(args); err != nil {
fmt.Fprintln(c.ErrStream, err)
fmt.Fprintln(app.ErrWriter, err)
return exitErr
}

return exitOK
}

func (c *CLI) checkAuthKey() error {
if len(c.conf.Auth.AuthKey) == 0 {
return fmt.Errorf("To setup, please run `deepl-cli setup`.")
func CheckAuthKeyAction(authKey string) cli.BeforeFunc {
return func(ctx *cli.Context) error {
if len(authKey) == 0 {
return fmt.Errorf("To get started with deepl-cli, please run: `deepl-cli configure`")
}
return nil
}
return nil
}
58 changes: 37 additions & 21 deletions internal/cmd/root_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/stretchr/testify/assert"
)

func TestRun(t *testing.T) {
func TestRun_Success(t *testing.T) {
tests := []struct {
name string
args []string
Expand All @@ -36,36 +36,52 @@ func TestRun(t *testing.T) {
wantOut: fmt.Sprintf("unknown command %q for \"deepl-cli\"\n", "hoge"),
wantExitCode: exitOK,
},
{
name: "repl",
args: strings.Split("deepl-cli repl", " "),
wantOut: fmt.Sprintf("Translate text from %s to %s\n>> ", "EN", "JA"),
wantExitCode: exitOK,
},
{
name: "repl with options",
args: strings.Split("deepl-cli repl -s JA -t EN", " "),
wantOut: fmt.Sprintf("Translate text from %s to %s\n>> ", "JA", "EN"),
wantExitCode: exitOK,
},
}

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
conf := &config.DeepLCLIConfig{
Auth: config.Auth{
AuthKey: "test-auth-key",
Credential: config.Credential{
DeepLAuthKey: "test-auth-key",
},
DefaultLanguage: config.DefaultLanguage{
SourceLanguage: "EN",
TargetLanguage: "JA",
Source: "EN",
Target: "JA",
},
}
inStream, outStream, errStream := new(bytes.Buffer), new(bytes.Buffer), new(bytes.Buffer)
cli := NewCLI(inStream, outStream, errStream, conf)
code := cli.Run(tt.args)
reader, writer, errWriter := new(bytes.Buffer), new(bytes.Buffer), new(bytes.Buffer)
cli := NewCLI(reader, writer, errWriter)
code := cli.Run(tt.args, conf)

assert.Equal(t, tt.wantOut, writer.String())
assert.Equal(t, tt.wantExitCode, code)
})
}
}

func TestRun_Failed(t *testing.T) {
tests := []struct {
name string
args []string
wantOut string
wantExitCode exitCode
}{
{
name: "check auth key",
args: strings.Split("deepl-cli repl", " "),
wantOut: fmt.Sprintf("To get started with deepl-cli, please run: `deepl-cli configure`\n"),
wantExitCode: exitErr,
},
}

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
conf := &config.DeepLCLIConfig{}
reader, writer, errWriter := new(bytes.Buffer), new(bytes.Buffer), new(bytes.Buffer)
cli := NewCLI(reader, writer, errWriter)
code := cli.Run(tt.args, conf)

assert.Equal(t, tt.wantOut, outStream.String())
assert.Equal(t, tt.wantOut, errWriter.String())
assert.Equal(t, tt.wantExitCode, code)
})
}
Expand Down
Loading

0 comments on commit 846d260

Please sign in to comment.