Skip to content

Commit

Permalink
feat(go): Add send command to shell
Browse files Browse the repository at this point in the history
  • Loading branch information
gfanton committed Jan 14, 2020
1 parent c6198c3 commit b2f7611
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion go/bind/ipfs/shell.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ type RequestBuilder struct {
rb *ipfs_api.RequestBuilder
}

func (req *RequestBuilder) Exec() ([]byte, error) {
func (req *RequestBuilder) Send() ([]byte, error) {
res, err := req.rb.Send(context.Background())
if err != nil {
return nil, err
Expand All @@ -123,6 +123,10 @@ func (req *RequestBuilder) Exec() ([]byte, error) {
return ioutil.ReadAll(res.Output)
}

func (req *RequestBuilder) Exec() error {
return req.Exec()
}

func (req *RequestBuilder) Argument(arg string) {
req.rb.Arguments(arg)
}
Expand Down
2 changes: 1 addition & 1 deletion go/bind/ipfs/shell_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func TestShell(t *testing.T) {
for cmdk, cmdtc := range casesCommand {
t.Run(cmdk, func(t *testing.T) {
req := shell.NewRequest("id")
res, err := req.Exec()
res, err := req.Send()
if err != nil {
t.Error(err)
}
Expand Down

0 comments on commit b2f7611

Please sign in to comment.