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-dms3
Commits
dfe64980
Commit
dfe64980
authored
May 29, 2018
by
Lucas Molas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd: fix `files ls` to report hash and size for files
License: MIT Signed-off-by:
Lucas Molas
<
schomatis@gmail.com
>
parent
139d6240
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
1 deletion
+24
-1
core/commands/files.go
core/commands/files.go
+18
-1
test/sharness/t0250-files-api.sh
test/sharness/t0250-files-api.sh
+6
-0
No files found.
core/commands/files.go
View file @
dfe64980
...
...
@@ -462,7 +462,24 @@ Examples:
return
case
*
mfs
.
File
:
_
,
name
:=
gopath
.
Split
(
path
)
out
:=
&
filesLsOutput
{[]
mfs
.
NodeListing
{
mfs
.
NodeListing
{
Name
:
name
,
Type
:
1
}}}
out
:=
&
filesLsOutput
{[]
mfs
.
NodeListing
{
mfs
.
NodeListing
{
Name
:
name
}}}
if
long
{
out
.
Entries
[
0
]
.
Type
=
int
(
fsn
.
Type
())
size
,
err
:=
fsn
.
Size
()
if
err
!=
nil
{
res
.
SetError
(
err
,
cmdkit
.
ErrNormal
)
return
}
out
.
Entries
[
0
]
.
Size
=
size
nd
,
err
:=
fsn
.
GetNode
()
if
err
!=
nil
{
res
.
SetError
(
err
,
cmdkit
.
ErrNormal
)
return
}
out
.
Entries
[
0
]
.
Hash
=
nd
.
Cid
()
.
String
()
}
res
.
SetOutput
(
out
)
return
default
:
...
...
test/sharness/t0250-files-api.sh
View file @
dfe64980
...
...
@@ -186,6 +186,12 @@ test_files_api() {
test_cmp ls_l_expected ls_l_actual
'
test_expect_success
"file has correct hash and size listed with -l"
'
echo "file1 $FILE1 4" > ls_l_expected &&
ipfs files ls -l /cats/file1 > ls_l_actual &&
test_cmp ls_l_expected ls_l_actual
'
test_expect_success
"can stat file
$EXTRA
"
'
ipfs files stat /cats/file1 > file1stat_orig
'
...
...
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