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
1957094f
Commit
1957094f
authored
Jan 03, 2016
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add type to stat cmd json output
License: MIT Signed-off-by:
Jeromy
<
jeromyj@gmail.com
>
parent
c242660d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
0 deletions
+12
-0
core/commands/files/files.go
core/commands/files/files.go
+12
-0
No files found.
core/commands/files/files.go
View file @
1957094f
...
@@ -115,11 +115,22 @@ func statNode(ds dag.DAGService, fsn mfs.FSNode) (*Object, error) {
...
@@ -115,11 +115,22 @@ func statNode(ds dag.DAGService, fsn mfs.FSNode) (*Object, error) {
return
nil
,
err
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
{
return
&
Object
{
Hash
:
k
.
B58String
(),
Hash
:
k
.
B58String
(),
Blocks
:
len
(
nd
.
Links
),
Blocks
:
len
(
nd
.
Links
),
Size
:
d
.
GetFilesize
(),
Size
:
d
.
GetFilesize
(),
CumulativeSize
:
cumulsize
,
CumulativeSize
:
cumulsize
,
Type
:
ndtype
,
},
nil
},
nil
}
}
...
@@ -187,6 +198,7 @@ type Object struct {
...
@@ -187,6 +198,7 @@ type Object struct {
Size
uint64
Size
uint64
CumulativeSize
uint64
CumulativeSize
uint64
Blocks
int
Blocks
int
Type
string
}
}
type
FilesLsOutput
struct
{
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