func (i *Tar) Nodes() []*widgets.TreeNode {

	var nodes []*widgets.TreeNode
	// currentTree := 0

	for _, layer := range i.Layers {
		var treeNodes []*widgets.TreeNode
		// tree := layer.Tree()
		// visitor := func(node *filetree.FileNode) error {

		// 	if !node.IsWhiteout() {
		// 		sizer := func(curNode *filetree.FileNode) error {
		// 			sizeBytes += curNode.Name
		// 			return nil
		// 		}
		// 		previousTreeNode, err := tree.GetNode(node.Path())
		// 		if err != nil {
		// 			log.Debug(fmt.Sprintf("CurrentTree: %d : %s", currentTree, err))
		// 		} else if previousTreeNode.Data.FileInfo.IsDir {
		// 			err = previousTreeNode.VisitDepthChildFirst(sizer, nil)
		// 			if err != nil {
		// 				log.Errorf("unable to propagate dir: %+v", err)
		// 			}
		// 		}
		// 	}

		// 	data.Nodes = append(data.Nodes, node)

		// 	return nil
		// }
		// visitEvaluator := func(node *filetree.FileNode) bool {
		// 	return node.IsLeaf()
		// }
		// if err := tree.VisitDepthChildFirst(visitor, visitEvaluator); err != nil {
		// 	return nil
		// }

		layer.Tree().VisitDepthChildFirst(func(node *filetree.FileNode) error {
			for _, child := range node.Children {
				if !child.IsWhiteout() {
					display := child.Path()
					if child.Data.FileInfo.TypeFlag == tar.TypeSymlink || child.Data.FileInfo.TypeFlag == tar.TypeLink {
						display += " → " + child.Data.FileInfo.Linkname
					}
					display += fmt.Sprintf(" (%s)", humanize.Bytes(uint64(child.Data.FileInfo.Size)))
					treeNodes = append(treeNodes, &widgets.TreeNode{
						Value: nodeValue(display),
						// Nodes: child.Children,
					})
				}
			}
			return nil
		}, nil)

		nodes = append(nodes, &widgets.TreeNode{
			Value: nodeValue(layer.TarID()),
			Nodes: treeNodes,
		})
	}

	return nodes
}
// Nodes returns the filetree as widget treenodes
Nodes returns the filetree as widget treenodes
// Nodes returns the filetree as widget treenodes
func (i *Tar) Nodes() []*widgets.TreeNode {
	var nodes []*widgets.TreeNode
	for _, layer := range i.Layers {
		var treeNodes []*widgets.TreeNode
		 else if previousTreeNode.Data.FileInfo.IsDir {
		layer.Tree().VisitDepthChildFirst(func(node *filetree.FileNode) error {
			for _, child := range node.Children {
				if !child.IsWhiteout() {
					display := child.Path()
					if child.Data.FileInfo.TypeFlag == tar.TypeSymlink || child.Data.FileInfo.TypeFlag == tar.TypeLink {
						display += " → " + child.Data.FileInfo.Linkname
					}
					display += fmt.Sprintf(" (%s)", humanize.Bytes(uint64(child.Data.FileInfo.Size)))
					treeNodes = append(treeNodes, &widgets.TreeNode{
						Value: nodeValue(display),
					})
				}
			}
			return nil
		}, nil)
		nodes = append(nodes, &widgets.TreeNode{
			Value: nodeValue(layer.TarID()),
			Nodes: treeNodes,
		})
	}
	return nodes
}
func ( i * Tar ) Nodes ( ) [ ] * widgets . TreeNode { var nodes [ ] * widgets . TreeNode for _ , layer := range i . Layers { var treeNodes [ ] * widgets . TreeNode layer . Tree ( ) . VisitDepthChildFirst ( func ( node * filetree . FileNode ) error { for _ , child := range node . Children { if ! child . IsWhiteout ( ) { display := child . Path ( ) if child . Data . FileInfo . TypeFlag == tar . TypeSymlink || child . Data . FileInfo . TypeFlag == tar . TypeLink { display += " + c ild.D a ta.F i leInfo.L i nkname } display += fmt . Sprintf ( " " , humanize . Bytes ( uint64 ( child . Data . FileInfo . Size ) ) ) treeNodes = append ( treeNodes , & widgets . TreeNode { Value : nodeValue ( display ) , } ) } } return nil } , nil ) nodes = append ( nodes , & widgets . TreeNode { Value : nodeValue ( layer . TarID ( ) ) , Nodes : treeNodes , } ) } return nodes }
Nodes returns the filetree as widget treenodes
Nodes returns the filetree as widget treenodes
// currentTree := 0 // tree := layer.Tree() // visitor := func(node *filetree.FileNode) error { // 	if !node.IsWhiteout() { // 		sizer := func(curNode *filetree.FileNode) error { // 			sizeBytes += curNode.Name // 			return nil // 		} // 		previousTreeNode, err := tree.GetNode(node.Path()) // 		if err != nil { // 			log.Debug(fmt.Sprintf("CurrentTree: %d : %s", currentTree, err)) // 		} else if previousTreeNode.Data.FileInfo.IsDir { // 			err = previousTreeNode.VisitDepthChildFirst(sizer, nil) // 			if err != nil { // 				log.Errorf("unable to propagate dir: %+v", err) // 			} // 		} // 	} // 	data.Nodes = append(data.Nodes, node) // 	return nil // } // visitEvaluator := func(node *filetree.FileNode) bool { // 	return node.IsLeaf() // } // if err := tree.VisitDepthChildFirst(visitor, visitEvaluator); err != nil { // 	return nil // } // Nodes: child.Children,