mirror of
https://github.com/rclone/rclone.git
synced 2024-12-11 09:41:47 +01:00
6427029c4e
* Update all dependencies * Remove all `[[constraint]]` from Gopkg.toml * Add in the minimum number of `[[override]]` to build * Remove go get of github.com/inconshreveable/mousetrap as it is vendored * Update docs with new policy on constraints |
||
---|---|---|
.. | ||
cmd/tree | ||
.gitignore | ||
.travis.yml | ||
color_test.go | ||
color.go | ||
compileall.sh | ||
csort_bsd.go | ||
csort_generic.go | ||
csort_unix.go | ||
LICENSE | ||
modes_bsd.go | ||
modes_unix.go | ||
modes_unsupported.go | ||
node_test.go | ||
node.go | ||
README.md | ||
sort.go | ||
stat_unix.go | ||
stat_unsupported.go |
tree
An implementation of the
tree
command written in Go, that can be used programmatically.
Installation:
$ go get github.com/a8m/tree/cmd/tree
How to use 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)
}
License
MIT