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
e4ee16fa
Commit
e4ee16fa
authored
Jul 05, 2014
by
Juan Batiz-Benet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cat and ls multifile
parent
5abf3c2a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
24 deletions
+31
-24
cli/Makefile
cli/Makefile
+3
-0
cli/cat.go
cli/cat.go
+13
-11
cli/ls.go
cli/ls.go
+15
-13
No files found.
cli/Makefile
View file @
e4ee16fa
...
...
@@ -3,3 +3,6 @@ all: build
build
:
go build
mv
cli ipfs
install
:
build
cp
ipfs /usr/local/bin/ipfs
cli/cat.go
View file @
e4ee16fa
...
...
@@ -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
}
cli/ls.go
View file @
e4ee16fa
...
...
@@ -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
}
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