Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-unixfs
Commits
35a87e9d
Commit
35a87e9d
authored
Sep 13, 2014
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
expand path names for add command, and pass errors up even more
parent
b55a5078
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
13 deletions
+21
-13
cmd/ipfs/add.go
cmd/ipfs/add.go
+1
-4
cmd/ipfs/cat.go
cmd/ipfs/cat.go
+6
-5
cmd/ipfs/ls.go
cmd/ipfs/ls.go
+1
-4
util/util.go
util/util.go
+13
-0
No files found.
cmd/ipfs/add.go
View file @
35a87e9d
...
...
@@ -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
}
cmd/ipfs/cat.go
View file @
35a87e9d
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
}
cmd/ipfs/ls.go
View file @
35a87e9d
...
...
@@ -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
...
...
util/util.go
View file @
35a87e9d
...
...
@@ -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
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment