summaryrefslogtreecommitdiffstats
path: root/pkg/commands/models
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/commands/models')
-rw-r--r--pkg/commands/models/status_line_node.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/pkg/commands/models/status_line_node.go b/pkg/commands/models/status_line_node.go
index 3ed1a573a..1a2471935 100644
--- a/pkg/commands/models/status_line_node.go
+++ b/pkg/commands/models/status_line_node.go
@@ -188,3 +188,18 @@ func (s *StatusLineNode) compressAux() *StatusLineNode {
func (s *StatusLineNode) HasExactlyOneChild() bool {
return len(s.Children) == 1
}
+
+// This ignores the root
+func (s *StatusLineNode) GetPathsMatching(test func(*StatusLineNode) bool) []string {
+ paths := []string{}
+
+ if test(s) {
+ paths = append(paths, s.GetPath())
+ }
+
+ for _, child := range s.Children {
+ paths = append(paths, child.GetPathsMatching(test)...)
+ }
+
+ return paths
+}