From e9d6c060efd29d436fef0e1dd7447b33765ab458 Mon Sep 17 00:00:00 2001 From: Overbool Date: Tue, 16 Oct 2018 22:15:04 +0800 Subject: [PATCH] fix(files): add slash for dir License: MIT Signed-off-by: Overbool --- core/commands/files.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/commands/files.go b/core/commands/files.go index 3fb48a2b6..720b28828 100644 --- a/core/commands/files.go +++ b/core/commands/files.go @@ -479,7 +479,7 @@ Examples: return case *mfs.File: _, name := gopath.Split(path) - out := &filesLsOutput{[]mfs.NodeListing{mfs.NodeListing{Name: name}}} + out := &filesLsOutput{[]mfs.NodeListing{{Name: name}}} if long { out.Entries[0].Type = int(fsn.Type()) @@ -527,6 +527,9 @@ Examples: long, _, _ := res.Request().Option(longOptionName).Bool() for _, o := range out.Entries { if long { + if o.Type == int(mfs.TDir) { + o.Name += "/" + } fmt.Fprintf(buf, "%s\t%s\t%d\n", o.Name, o.Hash, o.Size) } else { fmt.Fprintf(buf, "%s\n", o.Name)