An implementation of the Unix tree command written in Go, that can be used programmatically
Go
105
144 commits
updated Jan 4, 2024
An implementation of the
treecommand written in Go, that can be used programmatically.
$ go get github.com/a8m/tree/cmd/tree
tree programmatically ?You can take a look on cmd/tree, and s3tree or see the example below.
import (
"github.com/a8m/tree"
)
func main() {
opts := &tree.Options{
// Fs, and OutFile are required fields.
// fs should implement the tree file-system interface(see: tree.Fs),
// and OutFile should be type io.Writer
Fs: fs,
OutFile: os.Stdout,
// ...
}
inf.New("root-dir")
// Visit all nodes recursively
inf.Visit(opts)
// Print nodes
inf.Print(opts)
}
MIT
An implementation of the Unix tree command written in Go, that can be used programmatically
Go
105
144 commits
updated Jan 4, 2024
An implementation of the
treecommand written in Go, that can be used programmatically.
$ go get github.com/a8m/tree/cmd/tree
tree programmatically ?You can take a look on cmd/tree, and s3tree or see the example below.
import (
"github.com/a8m/tree"
)
func main() {
opts := &tree.Options{
// Fs, and OutFile are required fields.
// fs should implement the tree file-system interface(see: tree.Fs),
// and OutFile should be type io.Writer
Fs: fs,
OutFile: os.Stdout,
// ...
}
inf.New("root-dir")
// Visit all nodes recursively
inf.Visit(opts)
// Print nodes
inf.Print(opts)
}
MIT