Compare commits

...

2 Commits

Author SHA1 Message Date
u80864958
f2976c66e3 coppy to clipboard 2025-04-02 17:27:06 +02:00
u80864958
0562cc0877 add gitignore 2025-04-02 16:26:10 +02:00
2 changed files with 14 additions and 3 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
**/__debug_bin*
main

View File

@ -3,8 +3,10 @@ package main
import (
"flag"
"fmt"
"os"
"git.schreifuchs.ch/schreifuchs/pat/pkg/cat"
"git.schreifuchs.ch/schreifuchs/pat/pkg/clip"
"git.schreifuchs.ch/schreifuchs/pat/pkg/ignore"
)
@ -18,13 +20,15 @@ func main() {
cats, err := cat.Path(flag.Args()...)
if err != nil {
panic(err)
fmt.Println(err.Error())
os.Exit(1)
}
if *ignorePath != "" {
i, err := ignore.FindGitignore(*ignorePath)
if err != nil {
panic(err)
fmt.Printf("can't get gitignore: %v", err)
os.Exit(1)
}
cats = cats.Ignored(i)
@ -33,6 +37,11 @@ func main() {
cats = cats.Ignored(ignore.Filesystem{})
}
fmt.Print(cats.ToString(DELEMITTER))
out := cats.ToString(DELEMITTER)
fmt.Print(out)
if err = clip.Copy(out); err != nil {
fmt.Println(err.Error())
os.Exit(1)
}
}