renderTreeLine returns a string representing this FileNode in the context of a greater ASCII tree.
(spaces []bool, last bool, collapsed bool)
| 52 | |
| 53 | // renderTreeLine returns a string representing this FileNode in the context of a greater ASCII tree. |
| 54 | func (node *FileNode) renderTreeLine(spaces []bool, last bool, collapsed bool) string { |
| 55 | var otherBranches string |
| 56 | for _, space := range spaces { |
| 57 | if space { |
| 58 | otherBranches += noBranchSpace |
| 59 | } else { |
| 60 | otherBranches += branchSpace |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | thisBranch := middleItem |
| 65 | if last { |
| 66 | thisBranch = lastItem |
| 67 | } |
| 68 | |
| 69 | collapsedIndicator := uncollapsedItem |
| 70 | if collapsed { |
| 71 | collapsedIndicator = collapsedItem |
| 72 | } |
| 73 | |
| 74 | return otherBranches + thisBranch + collapsedIndicator + node.String() + newLine |
| 75 | } |
| 76 | |
| 77 | // Copy duplicates the existing node relative to a new parent node. |
| 78 | func (node *FileNode) Copy(parent *FileNode) *FileNode { |
no test coverage detected