Commit ff305581 authored by Jeromy's avatar Jeromy

make it easier to create custom dag objects via the CLI

parent 5ea2afc4
...@@ -24,7 +24,7 @@ const inputLimit = 512 * 1024 ...@@ -24,7 +24,7 @@ const inputLimit = 512 * 1024
type Node struct { type Node struct {
Links []Link Links []Link
Data []byte Data string
} }
var ObjectCmd = &cmds.Command{ var ObjectCmd = &cmds.Command{
...@@ -167,7 +167,7 @@ This command outputs data in the following encodings: ...@@ -167,7 +167,7 @@ This command outputs data in the following encodings:
node := &Node{ node := &Node{
Links: make([]Link, len(object.Links)), Links: make([]Link, len(object.Links)),
Data: object.Data, Data: string(object.Data),
} }
for i, link := range object.Links { for i, link := range object.Links {
...@@ -448,7 +448,7 @@ func getOutput(dagnode *dag.Node) (*Object, error) { ...@@ -448,7 +448,7 @@ func getOutput(dagnode *dag.Node) (*Object, error) {
// converts the Node object into a real dag.Node // converts the Node object into a real dag.Node
func deserializeNode(node *Node) (*dag.Node, error) { func deserializeNode(node *Node) (*dag.Node, error) {
dagnode := new(dag.Node) dagnode := new(dag.Node)
dagnode.Data = node.Data dagnode.Data = []byte(node.Data)
dagnode.Links = make([]*dag.Link, len(node.Links)) dagnode.Links = make([]*dag.Link, len(node.Links))
for i, link := range node.Links { for i, link := range node.Links {
hash, err := mh.FromB58String(link.Hash) hash, err := mh.FromB58String(link.Hash)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment