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 ¶
View Source
const (
// INF allows to have a full recursion until the leaves of a tree.
INF = -1
)
Variables ¶
View Source
var ErrNodePresent = fmt.Errorf("node already present")
ErrNodePresent is returned when a node with the same name is already present.
View Source
var ( // ErrNotFound is returned when a node is not found. ErrNotFound = fmt.Errorf("not found") )
Functions ¶
This section is empty.
Types ¶
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.
Click to show internal directories.
Click to hide internal directories.