Skip to content

Commit

Permalink
Merge pull request #4803 from ipfs/feat/coreapi/swarm
Browse files Browse the repository at this point in the history
coreapi: Swarm API
  • Loading branch information
Stebalien authored Oct 2, 2018
2 parents 080b0e1 + b2f6c3e commit 4f9bde8
Show file tree
Hide file tree
Showing 10 changed files with 427 additions and 281 deletions.
22 changes: 22 additions & 0 deletions core/commands/log.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package commands

import (
"bytes"
"fmt"
"io"

cmds "github.com/ipfs/go-ipfs/commands"
e "github.com/ipfs/go-ipfs/core/commands/e"

"gx/ipfs/QmSP88ryZkHSRn1fnngAaV2Vcn63WUJzAavnRM9CVdU1Ky/go-ipfs-cmdkit"
logging "gx/ipfs/QmZChCsSt8DctjceaL56Eibc29CVQq4dGKRXC5JRZ6Ppae/go-log"
Expand Down Expand Up @@ -110,3 +112,23 @@ Outputs event log messages (not other log messages) as they are generated.
res.SetOutput(r)
},
}

func stringListMarshaler(res cmds.Response) (io.Reader, error) {
v, err := unwrapOutput(res.Output())
if err != nil {
return nil, err
}

list, ok := v.(*stringList)
if !ok {
return nil, e.TypeErr(list, v)
}

buf := new(bytes.Buffer)
for _, s := range list.Strings {
buf.WriteString(s)
buf.WriteString("\n")
}

return buf, nil
}
2 changes: 1 addition & 1 deletion core/commands/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ var rootSubcommands = map[string]*cmds.Command{
"p2p": lgc.NewCommand(P2PCmd),
"refs": lgc.NewCommand(RefsCmd),
"resolve": ResolveCmd,
"swarm": lgc.NewCommand(SwarmCmd),
"swarm": SwarmCmd,
"tar": lgc.NewCommand(TarCmd),
"file": lgc.NewCommand(unixfs.UnixFSCmd),
"update": lgc.NewCommand(ExternalBinary()),
Expand Down
Loading

0 comments on commit 4f9bde8

Please sign in to comment.