Commit 74a0aa54 authored by Juan Batiz-Benet's avatar Juan Batiz-Benet Committed by Brian Tiger Chow

fixed [%s] bug

parent 8ed04cfe
......@@ -40,7 +40,6 @@ func addCmd(c *commander.Command, inp []string) error {
cmd := daemon.NewCommand()
cmd.Command = "add"
fmt.Println(inp)
cmd.Args = inp
cmd.Opts["r"] = c.Flag.Lookup("r").Value.Get()
err := daemon.SendCommand(cmd, "localhost:12345")
......
package commands
import (
"errors"
"fmt"
"io"
"io/ioutil"
......@@ -24,6 +25,9 @@ func Add(n *core.IpfsNode, args []string, opts map[string]interface{}, out io.Wr
for _, path := range args {
nd, err := AddPath(n, path, depth)
if err != nil {
if err == ErrDepthLimitExceeded && depth == 1 {
err = errors.New("use -r to recursively add directories.")
}
return fmt.Errorf("addFile error: %v", err)
}
......@@ -32,7 +36,7 @@ func Add(n *core.IpfsNode, args []string, opts map[string]interface{}, out io.Wr
return fmt.Errorf("addFile error: %v", err)
}
fmt.Fprintf(out, "Added node: %s = %s\n", path, k.Pretty())
fmt.Fprintf(out, "added %s %s\n", k.Pretty(), path)
}
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