Documentation ¶
Overview ¶
Package treefs provides functionality to print a simple graph of an fs.FS using the template of the `tree` command.
The version of `tree` whose graph is mimicked is tree v2.0.2 (c) 1996 - 2022 by Steve Baker, Thomas Moore, Francesc Rocher, Florian Sesser, Kyosuke Tokoro.
Index ¶
- func DirOnly(t *TreeFS)
- func FullPathPrefix(t *TreeFS)
- func Graph(fsys fs.FS, name string, opts ...Opt) (string, error)
- func Hidden(t *TreeFS)
- func Meta(fsys fs.FS, name string, opts ...Opt) (string, error)
- func Tree(fsys fs.FS, name string, opts ...Opt) (string, error)
- type Arg
- type Opt
- type TreeFS
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FullPathPrefix ¶ added in v0.3.0
func FullPathPrefix(t *TreeFS)
FullPathPrefix includes the full path prefix for each file.
Types ¶
type Opt ¶ added in v0.3.0
type Opt func(*TreeFS)
Opt defines an optional argument for generating an fs.FS's tree.
type TreeFS ¶
type TreeFS struct { NDirs int // the number of directories that exist within an fs.FS NFiles int // the number of files that exist within an fs.Fs // contains filtered or unexported fields }
TreeFS contains the required information to construct a graph for an fs.FS.
func New ¶
New returns a TreeFS whose stringer interface implementation returns the graph for the fs.FS fsys and name name, similar to the `tree` command.
It makes use of fs.ReadDir to walk fsys.
func NewMulti ¶
NewMulti returns an aggregate TreeFS.
The graph of each fs.FS, name pair are separated by newlines and the metadata is aggregated.
It makes use of fs.ReadDir to walk fsys.