// KeyListTextMarshaler outputs a KeyList as plaintext, one key per line func KeyListTextMarshaler(res cmds.Response) ([]byte, error) { output := res.Output().(*KeyList) s := "" for _, key := range output.Keys { s += key.B58String() + "\n" } return []byte(s), nil }
func bootstrapMarshaler(res cmds.Response) ([]byte, error) { v, ok := res.Output().(*BootstrapOutput) if !ok { return nil, u.ErrCast() } var buf bytes.Buffer err := bootstrapWritePeers(&buf, "", v.Peers) return buf.Bytes(), err }
func stringListMarshaler(res cmds.Response) ([]byte, error) { list, ok := res.Output().(*stringList) if !ok { return nil, errors.New("failed to cast []string") } var buf bytes.Buffer for _, s := range list.Strings { buf.Write([]byte(s)) buf.Write([]byte("\n")) } return buf.Bytes(), nil }
func MessageTextMarshaler(res cmds.Response) ([]byte, error) { return []byte(res.Output().(*MessageOutput).Message), nil }