24 lines
574 B
Go
24 lines
574 B
Go
package vaultview
|
|
|
|
import "git.julianfamily.org/keepassgo/internal/vault"
|
|
|
|
// HiddenRoot returns the single synthetic top-level vault group that should be
|
|
// treated as an internal storage root rather than as a user-visible group.
|
|
func HiddenRoot(model vault.Model) string {
|
|
if len(model.EntriesInPath(nil)) != 0 {
|
|
return ""
|
|
}
|
|
groups := model.ChildGroups(nil)
|
|
roots := make([]string, 0, len(groups))
|
|
for _, group := range groups {
|
|
if group == "Recycle Bin" {
|
|
continue
|
|
}
|
|
roots = append(roots, group)
|
|
}
|
|
if len(roots) != 1 {
|
|
return ""
|
|
}
|
|
return roots[0]
|
|
}
|