39 lines
761 B
Go
39 lines
761 B
Go
package main
|
|
|
|
import (
|
|
"flag"
|
|
"fmt"
|
|
|
|
"git.schreifuchs.ch/schreifuchs/pat/pkg/cat"
|
|
"git.schreifuchs.ch/schreifuchs/pat/pkg/ignore"
|
|
)
|
|
|
|
const DELEMITTER = "-(%s)--------------------------------------------------------------------------\n"
|
|
|
|
func main() {
|
|
|
|
ignorePath := flag.String("i", "", "set path to gitignore, if no gitignore parent dirs will be searched")
|
|
hiddenFiles := flag.Bool("h", false, "show hidden files")
|
|
flag.Parse()
|
|
|
|
cats, err := cat.Path(flag.Args()...)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
if *ignorePath != "" {
|
|
i, err := ignore.FindGitignore(*ignorePath)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
cats = cats.Ignored(i)
|
|
}
|
|
if *hiddenFiles == false {
|
|
cats = cats.Ignored(ignore.Filesystem{})
|
|
}
|
|
|
|
fmt.Print(cats.ToString(DELEMITTER))
|
|
|
|
}
|