Commit e4ee16fa authored by Juan Batiz-Benet's avatar Juan Batiz-Benet

cat and ls multifile

parent 5abf3c2a
......@@ -3,3 +3,6 @@ all: build
build:
go build
mv cli ipfs
install: build
cp ipfs /usr/local/bin/ipfs
......@@ -25,22 +25,24 @@ func catCmd(c *commander.Command, inp []string) error {
return nil
}
// for now only hashes, no path resolution
h, err := mh.FromB58String(inp[0])
if err != nil {
return err
}
n, err := localNode()
if err != nil {
return err
}
nd, err := n.GetDagNode(u.Key(h))
if err != nil {
return err
}
for _, fn := range inp {
// for now only hashes, no path resolution
h, err := mh.FromB58String(fn)
if err != nil {
return err
}
u.POut("%s", nd.Data)
nd, err := n.GetDagNode(u.Key(h))
if err != nil {
return err
}
u.POut("%s", nd.Data)
}
return nil
}
......@@ -28,24 +28,26 @@ func lsCmd(c *commander.Command, inp []string) error {
return nil
}
// for now only hashes, no path resolution
h, err := mh.FromB58String(inp[0])
if err != nil {
return err
}
n, err := localNode()
if err != nil {
return err
}
nd, err := n.GetDagNode(u.Key(h))
if err != nil {
return err
}
for _, link := range nd.Links {
u.POut("%s %d %s\n", link.Hash.B58String(), link.Size, link.Name)
for _, fn := range inp {
// for now only hashes, no path resolution
h, err := mh.FromB58String(fn)
if err != nil {
return err
}
nd, err := n.GetDagNode(u.Key(h))
if err != nil {
return err
}
for _, link := range nd.Links {
u.POut("%s %d %s\n", link.Hash.B58String(), link.Size, link.Name)
}
}
return nil
}
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