Skip to content

Commit

Permalink
commands/files: use cmds.EmitOnce in single value
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Overbool <overbool.xu@gmail.com>
  • Loading branch information
overbool committed Oct 30, 2018
1 parent 184b770 commit 67c4e2d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions core/commands/files.go
Original file line number Diff line number Diff line change
Expand Up @@ -451,13 +451,13 @@ Examples:
Name: name,
})
}
return res.Emit(&filesLsOutput{output})
return cmds.EmitOnce(res, &filesLsOutput{output})
}
listing, err := fsn.List(req.Context)
if err != nil {
return err
}
return res.Emit(&filesLsOutput{listing})
return cmds.EmitOnce(res, &filesLsOutput{listing})
case *mfs.File:
_, name := gopath.Split(path)
out := &filesLsOutput{[]mfs.NodeListing{{Name: name}}}
Expand All @@ -476,7 +476,7 @@ Examples:
}
out.Entries[0].Hash = nd.Cid().String()
}
return res.Emit(out)
return cmds.EmitOnce(res, out)
default:
return errors.New("unrecognized type")
}
Expand Down

0 comments on commit 67c4e2d

Please sign in to comment.