diff --git a/cli/Makefile b/cli/Makefile index fcc01c36a12ee24973ce6975afe5d6ca89783079..3771940c34502f038b885666542bbb28badf29e9 100644 --- a/cli/Makefile +++ b/cli/Makefile @@ -3,3 +3,6 @@ all: build build: go build mv cli ipfs + +install: build + cp ipfs /usr/local/bin/ipfs diff --git a/cli/cat.go b/cli/cat.go index 73d6a25d811b525bd14c2bdfd35aa864816f0a0e..1938bed76ce6be43a668b68ee5ff0912b4ec684d 100644 --- a/cli/cat.go +++ b/cli/cat.go @@ -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 } diff --git a/cli/ls.go b/cli/ls.go index bb1621590b9f29225d93779ba2c27446808aef86..ebc7d139c6085cb1cc50c82a77a762b0279c2677 100644 --- a/cli/ls.go +++ b/cli/ls.go @@ -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 }