Documentation ¶
Overview ¶
Package tree implements a tree for displaying hierarchical password store entries. It is loosely based on https://github.com/restic/restic/blob/master/internal/restic/tree.go
Index ¶
- Constants
- Variables
- type Node
- type Nodes
- type Root
- func (r *Root) AddFile(path string, _ string) error
- func (r *Root) AddMount(path, dest string) error
- func (r *Root) AddTemplate(path string) error
- func (r *Root) FindFolder(path string) (*Root, error)
- func (r *Root) Format(maxDepth int) string
- func (r *Root) Len() int
- func (r *Root) List(maxDepth int) []string
- func (r *Root) ListFolders(maxDepth int) []string
- func (r *Root) SetName(n string)
- func (r *Root) String() string
- type Tree
Constants ¶
const (
// INF allows to have a full recursion until the leaves of a tree.
INF = -1
)
Variables ¶
var ErrNodePresent = fmt.Errorf("node already present")
ErrNodePresent is returned when a node with the same name is already present.
var ( // ErrNotFound is returned when a node is not found. ErrNotFound = fmt.Errorf("not found") )
Functions ¶
This section is empty.
Types ¶
type Node ¶
Node is a tree node.
func (Node) Merge ¶ added in v1.14.7
Merge will merge two nodes into a new node. Does not change either of the two input nodes. The merged node will be in the returned node. Implements semantics specific to gopass' tree model, i.e. mounts shadow (erase) everything below a mount point, nodes within a tree can be leafs (i.e. contain a secret as well as subdirectories) and any node can also contain a template.
type Root ¶
Root is the root of a tree. It contains a name and a subtree.
func (*Root) AddTemplate ¶
AddTemplate adds a template to the tree.
func (*Root) FindFolder ¶
FindFolder returns the subtree rooted at path.
func (*Root) Format ¶
Format returns a pretty printed string of all nodes in and below this node, e.g. `├── baz`.
func (*Root) Len ¶
Len returns the number of entries in this folder and all subfolder including this folder itself.
func (*Root) ListFolders ¶
ListFolders returns a flat list of all folders in this tree.