Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

coreapi: Swarm API #4803

Merged
merged 8 commits into from
Oct 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -136,7 +136,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