Skip to content

Commit 16f14e9

Browse files
committed
revert local encoder
1 parent 957684f commit 16f14e9

File tree

2 files changed

+1
-22
lines changed

2 files changed

+1
-22
lines changed

executor.go

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ package cmds
22

33
import (
44
"context"
5-
"io"
6-
"io/ioutil"
75
"os"
86
)
97

@@ -35,25 +33,6 @@ type executor struct {
3533
root *Command
3634
}
3735

38-
// GetLocalEncoder provides special treatment for text encoding
39-
// when Command.DisplayCLI field is non-nil, by defining an
40-
// Encoder that delegates to a nested emitter that consumes a Response
41-
// and writes to the underlying io.Writer using DisplayCLI.
42-
func GetLocalEncoder(req *Request, w io.Writer, def EncodingType) (EncodingType, Encoder, error) {
43-
encType, enc, err := GetEncoder(req, w, def)
44-
if err != nil {
45-
return encType, nil, err
46-
}
47-
48-
if req.Command.DisplayCLI != nil && encType == Text {
49-
emitter, response := NewChanResponsePair(req)
50-
go req.Command.DisplayCLI(response, w, ioutil.Discard)
51-
return encType, &emitterEncoder{emitter: emitter}, nil
52-
}
53-
54-
return encType, enc, nil
55-
}
56-
5736
type emitterEncoder struct {
5837
emitter ResponseEmitter
5938
}

http/responseemitter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ var (
2727

2828
// NewResponseEmitter returns a new ResponseEmitter.
2929
func NewResponseEmitter(w http.ResponseWriter, method string, req *cmds.Request, opts ...ResponseEmitterOption) (ResponseEmitter, error) {
30-
encType, enc, err := cmds.GetLocalEncoder(req, w, cmds.JSON)
30+
encType, enc, err := cmds.GetEncoder(req, w, cmds.JSON)
3131
if err != nil {
3232
return nil, err
3333
}

0 commit comments

Comments
 (0)