commands: Made PostRun signature match Run
Matt Bell committed
Jan 22, 2015 at 23:21 UTC
5706471897583b9a3ce2f2afa70fb81a354519b5
4 files changed
+6
-6
cmd/ipfs/main.go
+1
-1
@@ -356,7 +356,7 @@ func callCommand(ctx context.Context, req cmds.Request, root *cmds.Command, cmd
356
}
357
358
if cmd.PostRun != nil {
359
- cmd.PostRun(res)
359
+ cmd.PostRun(req, res)
360
}
361
362
return res, nil
commands/command.go
+1
-1
@@ -47,7 +47,7 @@ type Command struct {
47
Arguments []Argument
48
PreRun func(req Request) error
49
Run Function
50
- PostRun func(res Response)
50
+ PostRun Function
51
Marshalers map[EncodingType]Marshaler
52
Helptext HelpText
53
core/commands/add.go
+3
-3
@@ -104,7 +104,7 @@ remains to be implemented.
104
}
105
}()
106
},
107
- PostRun: func(res cmds.Response) {
107
+ PostRun: func(req cmds.Request, res cmds.Response) {
108
outChan, ok := res.Output().(<-chan interface{})
109
if !ok {
110
res.SetError(u.ErrCast(), cmds.ErrNormal)
@@ -112,14 +112,14 @@ remains to be implemented.
112
}
113
res.SetOutput(nil)
114
115
- quiet, _, err := res.Request().Option("quiet").Bool()
115
+ quiet, _, err := req.Option("quiet").Bool()
116
if err != nil {
117
res.SetError(u.ErrCast(), cmds.ErrNormal)
118
return
119
}
120
121
size := int64(0)
122
- s, found := res.Request().Values()["size"]
122
+ s, found := req.Values()["size"]
123
if found {
124
size = s.(int64)
125
}
core/commands/cat.go
+1
-1
@@ -44,7 +44,7 @@ it contains.
44
reader := io.MultiReader(readers...)
45
res.SetOutput(reader)
46
},
47
- PostRun: func(res cmds.Response) {
47
+ PostRun: func(req cmds.Request, res cmds.Response) {
48
if res.Length() < progressBarMinSize {
49
return
50
}