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
75a63b74
Commit
75a63b74
authored
Jan 16, 2016
by
Juan Benet
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2209 from ipfs/feat/stat-type
make files stat print out node type
parents
f89a915c
f485fa4b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
0 deletions
+13
-0
core/commands/files/files.go
core/commands/files/files.go
+13
-0
No files found.
core/commands/files/files.go
View file @
75a63b74
...
...
@@ -87,6 +87,7 @@ var FilesStatCmd = &cmds.Command{
fmt
.
Fprintf
(
buf
,
"Size: %d
\n
"
,
out
.
Size
)
fmt
.
Fprintf
(
buf
,
"CumulativeSize: %d
\n
"
,
out
.
CumulativeSize
)
fmt
.
Fprintf
(
buf
,
"ChildBlocks: %d
\n
"
,
out
.
Blocks
)
fmt
.
Fprintf
(
buf
,
"Type: %s
\n
"
,
out
.
Type
)
return
buf
,
nil
},
},
...
...
@@ -115,11 +116,22 @@ func statNode(ds dag.DAGService, fsn mfs.FSNode) (*Object, error) {
return
nil
,
err
}
var
ndtype
string
switch
fsn
.
Type
()
{
case
mfs
.
TDir
:
ndtype
=
"directory"
case
mfs
.
TFile
:
ndtype
=
"file"
default
:
return
nil
,
fmt
.
Errorf
(
"unrecognized node type: %s"
,
fsn
.
Type
())
}
return
&
Object
{
Hash
:
k
.
B58String
(),
Blocks
:
len
(
nd
.
Links
),
Size
:
d
.
GetFilesize
(),
CumulativeSize
:
cumulsize
,
Type
:
ndtype
,
},
nil
}
...
...
@@ -187,6 +199,7 @@ type Object struct {
Size
uint64
CumulativeSize
uint64
Blocks
int
Type
string
}
type
FilesLsOutput
struct
{
...
...
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