@cryptotaxi247 / kubo / commits / f988a54c1

`repo stat`: add Type

License: MIT Signed-off-by: Thomas Gardner <tmg@fastmail.com>

Thomas Gardner committed Feb 5, 2016 at 11:22 UTC f988a54c1bb6a0fbcadaef0a0ef4edee7d26f163
1 file changed +6 -5
core/commands/repo.go
+6 -5
@@ -141,13 +141,13 @@ var repoStatCmd = &cmds.Command{
141 return
142 }
143
144 - out := &RepoStat{
144 + res.SetOutput(&RepoStat{
145 repoPath: path,
146 repoSize: usage,
147 numBlocks: count,
148 - }
149 - res.SetOutput(out)
148 + })
149 },
150 + Type: RepoStat{},
151 Marshalers: cmds.MarshalerMap{
152 cmds.Text: func(res cmds.Response) (io.Reader, error) {
153 stat, ok := res.Output().(*RepoStat)
@@ -155,9 +155,10 @@ var repoStatCmd = &cmds.Command{
155 return nil, u.ErrCast()
156 }
157
158 - out := fmt.Sprintf("Path: %s\nSize: %d bytes\n"+
159 - "Blocks: %d\n",
158 + out := fmt.Sprintf(
159 + "Path: %s\nSize: %d bytes\nBlocks: %d\n",
160 stat.repoPath, stat.repoSize, stat.numBlocks)
161 +
162 return strings.NewReader(out), nil
163 },
164 },