mirror of
https://github.com/vbatts/go-mtree.git
synced 2024-11-26 01:55:39 +00:00
40 lines
552 B
Go
40 lines
552 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"bufio"
|
||
|
"flag"
|
||
|
"fmt"
|
||
|
"log"
|
||
|
"os"
|
||
|
"strings"
|
||
|
)
|
||
|
|
||
|
func main() {
|
||
|
flag.Parse()
|
||
|
_ = mtree.DirectoryHierarchy{}
|
||
|
for _, file := range flag.Args() {
|
||
|
func() {
|
||
|
fh, err := os.Open(file)
|
||
|
if err != nil {
|
||
|
log.Println(err)
|
||
|
return
|
||
|
}
|
||
|
defer fh.Close()
|
||
|
|
||
|
s := bufio.NewScanner(fh)
|
||
|
for s.Scan() {
|
||
|
str := s.Text()
|
||
|
switch {
|
||
|
case strings.HasPrefix(str, "#"):
|
||
|
continue
|
||
|
default:
|
||
|
}
|
||
|
fmt.Printf("%q\n", str)
|
||
|
}
|
||
|
if err := s.Err(); err != nil {
|
||
|
log.Println("ERROR:", err)
|
||
|
}
|
||
|
}()
|
||
|
}
|
||
|
}
|