mirror of
https://github.com/vbatts/go-mtree.git
synced 2024-11-25 09:35:39 +00:00
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
22
walk.go
22
walk.go
|
@ -37,15 +37,25 @@ func Walk(root string, exlcudes []ExcludeFunc, keywords []string) (*DirectoryHie
|
|||
}
|
||||
|
||||
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
|
||||
/*
|
||||
if creator.curDir != nil {
|
||||
creator.DH.Entries = append(creator.DH.Entries, Entry{
|
||||
Raw: "# " + creator.curDir.Path(),
|
||||
Pos: len(creator.DH.Entries),
|
||||
Raw: "# " + filepath.Join(creator.curDir.Path(), filepath.Base(path)),
|
||||
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
|
||||
if creator.curSet == nil {
|
||||
|
@ -81,7 +91,6 @@ func Walk(root string, exlcudes []ExcludeFunc, keywords []string) (*DirectoryHie
|
|||
needNewSet = true
|
||||
}
|
||||
}
|
||||
|
||||
if needNewSet {
|
||||
e := Entry{
|
||||
Name: "/set",
|
||||
|
@ -91,11 +100,6 @@ func Walk(root string, exlcudes []ExcludeFunc, keywords []string) (*DirectoryHie
|
|||
}
|
||||
creator.curSet = &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