fix(files): add slash for dir
License: MIT Signed-off-by: Overbool <overbool.xu@gmail.com>
Overbool committed
Oct 16, 2018 at 22:15 UTC
e9d6c060efd29d436fef0e1dd7447b33765ab458
1 file changed
+4
-1
core/commands/files.go
+4
-1
@@ -479,7 +479,7 @@ Examples:
479
return
480
case *mfs.File:
481
_, name := gopath.Split(path)
482
- out := &filesLsOutput{[]mfs.NodeListing{mfs.NodeListing{Name: name}}}
482
+ out := &filesLsOutput{[]mfs.NodeListing{{Name: name}}}
483
if long {
484
out.Entries[0].Type = int(fsn.Type())
485
@@ -527,6 +527,9 @@ Examples:
527
long, _, _ := res.Request().Option(longOptionName).Bool()
528
for _, o := range out.Entries {
529
if long {
530
+ if o.Type == int(mfs.TDir) {
531
+ o.Name += "/"
532
+ }
533
fmt.Fprintf(buf, "%s\t%s\t%d\n", o.Name, o.Hash, o.Size)
534
} else {
535
fmt.Fprintf(buf, "%s\n", o.Name)