@cryptotaxi247 / kubo / commits / 74a0aa54a

fixed [%s] bug

Juan Batiz-Benet committed Sep 20, 2014 at 06:45 UTC 74a0aa54ad9ed062154a075fed35727c1e4869d4
2 files changed +5 -2
cmd/ipfs/add.go
-1
@@ -40,7 +40,6 @@ func addCmd(c *commander.Command, inp []string) error {
40
41 cmd := daemon.NewCommand()
42 cmd.Command = "add"
43 - fmt.Println(inp)
43 cmd.Args = inp
44 cmd.Opts["r"] = c.Flag.Lookup("r").Value.Get()
45 err := daemon.SendCommand(cmd, "localhost:12345")
core/commands/add.go
+5 -1
@@ -1,6 +1,7 @@
1 package commands
2
3 import (
4 + "errors"
5 "fmt"
6 "io"
7 "io/ioutil"
@@ -24,6 +25,9 @@ func Add(n *core.IpfsNode, args []string, opts map[string]interface{}, out io.Wr
25 for _, path := range args {
26 nd, err := AddPath(n, path, depth)
27 if err != nil {
28 + if err == ErrDepthLimitExceeded && depth == 1 {
29 + err = errors.New("use -r to recursively add directories.")
30 + }
31 return fmt.Errorf("addFile error: %v", err)
32 }
33
@@ -32,7 +36,7 @@ func Add(n *core.IpfsNode, args []string, opts map[string]interface{}, out io.Wr
36 return fmt.Errorf("addFile error: %v", err)
37 }
38
35 - fmt.Fprintf(out, "Added node: %s = %s\n", path, k.Pretty())
39 + fmt.Fprintf(out, "added %s %s\n", k.Pretty(), path)
40 }
41 return nil
42 }