filetree

package
v0.1.30549 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 14, 2024 License: MIT Imports: 7 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SpecialCase func(path string) bool

SpecialCase is a function you can pass to NewTree in order to override the behavior when marshalling a node.

Functions

This section is empty.

Types

type Node

type Node struct {
	FullPath string      `json:"full_path"`
	Info     os.FileInfo `json:"-"`
	Children []*Node     `json:"-"`
	Parent   *Node       `json:"-"`
}

Node represents a leaf in the filetree

func NewTree

func NewTree(rootPath string, allowedDirectories ...string) (*Node, error)

NewTree creates a new filetree starting at the root

func (Node) MarshalYAML

func (n Node) MarshalYAML() (interface{}, error)

MarshalYAML serializes the tree into YAML

type PathNodes

type PathNodes struct {
	Map  map[string]*Node
	Keys []string
}

PathNodes is a map of filepaths to tree nodes with ordered path keys.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL