simple

package
v1.2.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2017 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File struct {
	Name     string
	Metadata map[string]string
}

File is a leaf node in the tree

func (File) IsBinary

func (f File) IsBinary() bool

IsBinary returns true if this is a binary file

func (File) String

func (f File) String() string

String implement fmt.Stringer

type Folder

type Folder struct {
	Name    string // Name is the displayed name of this folder
	Path    string // Path is only used for mounts, it's the on-disk path
	Root    bool   // Root is used for the root node to remove any prefix
	HasTpl  bool
	Folders map[string]*Folder // the sub-entries, prevents having files and folder w/ same name
	Files   map[string]*File
}

Folder is intermediate tree node

func New

func New(name string) *Folder

New create a new root folder

func (*Folder) AddFile

func (f *Folder) AddFile(name string, contentType string) error

AddFile adds a new file

func (*Folder) AddMount

func (f *Folder) AddMount(name, path string) error

AddMount adds a new mount

func (*Folder) AddTemplate

func (f *Folder) AddTemplate(name string) error

AddTemplate adds a new template

func (*Folder) FindFolder

func (f *Folder) FindFolder(name string) tree.Tree

FindFolder returns a sub-tree or nil, if the subtree does not exist

func (*Folder) Format

func (f *Folder) Format(maxDepth int) string

Format returns a pretty printed tree

func (*Folder) IsMount

func (f *Folder) IsMount() bool

IsMount returns true if the path is non-empty

func (Folder) List

func (f Folder) List(maxDepth int) []string

List returns a flattened list of all sub nodes

func (*Folder) SetName

func (f *Folder) SetName(name string)

SetName sets the name of this folder

func (*Folder) SetRoot

func (f *Folder) SetRoot(on bool)

SetRoot sets the root flag of this folder

func (*Folder) String

func (f *Folder) String() string

String implement fmt.Stringer

Jump to

Keyboard shortcuts

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