Commit 35a87e9d authored by Jeromy's avatar Jeromy

expand path names for add command, and pass errors up even more

parent b55a5078
......@@ -51,10 +51,7 @@ func addCmd(c *commander.Command, inp []string) error {
return err
}
err = commands.Add(n, cmd.Args, cmd.Opts, os.Stdout)
if err != nil {
fmt.Println(err)
}
return commands.Add(n, cmd.Args, cmd.Opts, os.Stdout)
}
return nil
}
package main
import (
"fmt"
"os"
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/gonuts/flag"
......@@ -29,6 +28,11 @@ func catCmd(c *commander.Command, inp []string) error {
return nil
}
expanded, err := u.ExpandPathnames(inp)
if err != nil {
return err
}
com := daemon.NewCommand()
com.Command = "cat"
com.Args = inp
......@@ -40,10 +44,7 @@ func catCmd(c *commander.Command, inp []string) error {
return err
}
err = commands.Cat(n, com.Args, com.Opts, os.Stdout)
if err != nil {
fmt.Println(err)
}
return commands.Cat(n, com.Args, com.Opts, os.Stdout)
}
return nil
}
......@@ -43,10 +43,7 @@ func lsCmd(c *commander.Command, inp []string) error {
return err
}
err = commands.Ls(n, com.Args, com.Opts, os.Stdout)
if err != nil {
fmt.Println(err)
}
return commands.Ls(n, com.Args, com.Opts, os.Stdout)
}
return nil
......
......@@ -5,6 +5,7 @@ import (
"fmt"
"os"
"os/user"
"path/filepath"
"strings"
b58 "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-base58"
......@@ -78,3 +79,15 @@ func DOut(format string, a ...interface{}) {
POut(format, a...)
}
}
func ExpandPathnames(paths []string) ([]string, error) {
var out []string
for _, p := range paths {
abspath, err := filepath.Abs(p)
if err != nil {
return nil, err
}
out = append(out, abspath)
}
return out, 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