6
0
mirror of https://github.com/grdl/git-get.git synced 2026-02-08 16:19:19 +00:00

Add output flag and simple tree option

This commit is contained in:
Grzegorz Dlugoszewski
2020-06-08 14:00:59 +02:00
parent f3d0df1bfd
commit e5c3285040
8 changed files with 123 additions and 54 deletions

View File

@@ -96,9 +96,9 @@ gitlab.com/
repos = append(repos, git.NewRepo(nil, path)) //&Repo{path: path})
}
tree := BuildTree("root", repos)
printer := SmartTreePrinter{}
// Leading and trailing newlines are added to test cases for readability. We also need to add them to the rendering result.
got := fmt.Sprintf("\n%s\n", RenderSmartTree(tree))
got := fmt.Sprintf("\n%s\n", printer.Print("root", repos))
// Rendered tree uses spaces for indentation but the test cases use tabs.
if got != strings.ReplaceAll(test.want, "\t", " ") {