27 lines
416 B
Go
27 lines
416 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"flag"
|
||
|
"fmt"
|
||
|
"time"
|
||
|
)
|
||
|
|
||
|
func main() {
|
||
|
var path string
|
||
|
var depth int
|
||
|
flag.StringVar(&path, "path", ".", "Path from where to start the walk from")
|
||
|
flag.IntVar(&depth, "depth", 0, "Depth to display")
|
||
|
flag.Parse()
|
||
|
|
||
|
t := NewTop(path)
|
||
|
go t.Spawn(depth)
|
||
|
go t.Collect()
|
||
|
for {
|
||
|
select {
|
||
|
case <-time.After(500 * time.Millisecond):
|
||
|
fmt.Printf("\033[H\033[2J")
|
||
|
fmt.Println(t)
|
||
|
}
|
||
|
}
|
||
|
}
|