MCPcopy
hub / github.com/wagoodman/dive / Remove

Method Remove

dive/filetree/file_node.go:109–122  ·  view source on GitHub ↗

Remove deletes the current FileNode from it's parent FileNode's relations.

()

Source from the content-addressed store, hash-verified

107
108// Remove deletes the current FileNode from it's parent FileNode's relations.
109func (node *FileNode) Remove() error {
110 if node == node.Tree.Root {
111 return fmt.Errorf("cannot remove the tree root")
112 }
113 for _, child := range node.Children {
114 err := child.Remove()
115 if err != nil {
116 return err
117 }
118 }
119 delete(node.Parent.Children, node.Name)
120 node.Tree.Size--
121 return nil
122}
123
124// String shows the filename formatted into the proper color (by DiffType), additionally indicating if it is a symlink.
125func (node *FileNode) String() string {

Callers 4

TestRemoveChildFunction · 0.80
RemovePathMethod · 0.80
buildImageFromCliFunction · 0.80
buildImageFromCliFunction · 0.80

Calls

no outgoing calls

Tested by 1

TestRemoveChildFunction · 0.64