walk: insert comments regarding directory path

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
Vincent Batts 2016-03-22 12:56:36 -04:00
parent 1cd7a57573
commit 6db2f462a1

32
walk.go
View file

@ -37,15 +37,25 @@ func Walk(root string, exlcudes []ExcludeFunc, keywords []string) (*DirectoryHie
} }
if info.IsDir() { if info.IsDir() {
creator.DH.Entries = append(creator.DH.Entries, Entry{
Type: BlankType,
Pos: len(creator.DH.Entries),
})
// TODO Insert a comment of the full path of the directory's name // TODO Insert a comment of the full path of the directory's name
/* if creator.curDir != nil {
if creator.curDir != nil { creator.DH.Entries = append(creator.DH.Entries, Entry{
creator.DH.Entries = append(creator.DH.Entries, Entry{ Pos: len(creator.DH.Entries),
Raw: "# " + creator.curDir.Path(), Raw: "# " + filepath.Join(creator.curDir.Path(), filepath.Base(path)),
Type: CommentType, Type: CommentType,
}) })
} } else {
*/ creator.DH.Entries = append(creator.DH.Entries, Entry{
Pos: len(creator.DH.Entries),
Raw: "# " + filepath.Base(path),
Type: CommentType,
})
}
// set the initial /set keywords // set the initial /set keywords
if creator.curSet == nil { if creator.curSet == nil {
@ -81,7 +91,6 @@ func Walk(root string, exlcudes []ExcludeFunc, keywords []string) (*DirectoryHie
needNewSet = true needNewSet = true
} }
} }
if needNewSet { if needNewSet {
e := Entry{ e := Entry{
Name: "/set", Name: "/set",
@ -91,11 +100,6 @@ func Walk(root string, exlcudes []ExcludeFunc, keywords []string) (*DirectoryHie
} }
creator.curSet = &e creator.curSet = &e
creator.DH.Entries = append(creator.DH.Entries, e) creator.DH.Entries = append(creator.DH.Entries, e)
} else {
creator.DH.Entries = append(creator.DH.Entries, Entry{
Type: BlankType,
Pos: len(creator.DH.Entries),
})
} }
} }
} }