Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit d0dd3b2

Browse files
committedJan 4, 2016
add type to stat cmd json output
License: MIT Signed-off-by: Jeromy <jeromyj@gmail.com>
1 parent 1c1f9c6 commit d0dd3b2

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed
 

‎core/commands/files/files.go

+10
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,20 @@ func statNode(ds dag.DAGService, fsn mfs.FSNode) (*Object, error) {
115115
return nil, err
116116
}
117117

118+
var ndtype string
119+
switch fsn.Type() {
120+
case mfs.TDir:
121+
ndtype = "directory"
122+
case mfs.TFile:
123+
ndtype = "file"
124+
}
125+
118126
return &Object{
119127
Hash: k.B58String(),
120128
Blocks: len(nd.Links),
121129
Size: d.GetFilesize(),
122130
CumulativeSize: cumulsize,
131+
Type: ndtype,
123132
}, nil
124133
}
125134

@@ -187,6 +196,7 @@ type Object struct {
187196
Size uint64
188197
CumulativeSize uint64
189198
Blocks int
199+
Type string
190200
}
191201

192202
type FilesLsOutput struct {

0 commit comments

Comments
 (0)
Please sign in to comment.