walk: insert comments regarding directory path
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
parent
1cd7a57573
commit
6db2f462a1
1 changed files with 18 additions and 14 deletions
32
walk.go
32
walk.go
|
@ -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),
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue