coppy to clipboard

This commit is contained in:
u80864958 2025-04-02 17:27:06 +02:00
parent 0562cc0877
commit f2976c66e3
2 changed files with 13 additions and 3 deletions

1
.gitignore vendored
View File

@ -1 +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)
}
}