-
Notifications
You must be signed in to change notification settings - Fork 237
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Marshalling filetree can now handle most basic cases
NewTree now accepts a specialCase function which is used during MarshalYAML. NewTree also ensures to avoid any dotfolders, such as .git, except for the root path and doesn't bother with dotfiles necessarily. I've also fixed NewTree to properly set the absolute path on the node. The next biggest change is how we marshal parents: * If a child is within the root directory, merge it onto the tree * Given the basename of a child, compare that to the special case fn * If true, merge it onto the parent of the child inside the tree * Otherwise merge the child under it's name Names when used for keys are stripped of their file extension. When used for comparison in special cases, we just use the basename. I've introduced a handfull of helper methods for these cases, such as finding the root node or whether a file is YAML based on extension. This change also introduces a private mergeTree function, that will convert any interfaces to map[string]interface{} and combine them. Here be dragons. 🐲
- Loading branch information
Zachary Scott
committed
Jun 20, 2018
1 parent
980eb71
commit 9a1d028
Showing
3 changed files
with
91 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters