Skip to content

Commit

Permalink
add type to stat cmd json output
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
  • Loading branch information
whyrusleeping committed Jan 4, 2016
1 parent 1c1f9c6 commit d0dd3b2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions core/commands/files/files.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,20 @@ 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"
}

return &Object{
Hash: k.B58String(),
Blocks: len(nd.Links),
Size: d.GetFilesize(),
CumulativeSize: cumulsize,
Type: ndtype,
}, nil
}

Expand Down Expand Up @@ -187,6 +196,7 @@ type Object struct {
Size uint64
CumulativeSize uint64
Blocks int
Type string
}

type FilesLsOutput struct {
Expand Down

0 comments on commit d0dd3b2

Please sign in to comment.