main
bel 2025-04-04 23:48:35 -06:00
parent da9e0942fe
commit 8185311a4f
1 changed files with 19 additions and 4 deletions

23
main.go
View File

@ -5,6 +5,7 @@ import (
"encoding/json"
"flag"
"fmt"
"io"
"os"
"os/signal"
"path"
@ -25,6 +26,22 @@ func main() {
ctx, can := signal.NotifyContext(context.Background(), syscall.SIGINT)
defer can()
if len(os.Args) < 2 {
if err := Recursive(ctx); err != nil {
panic(err)
}
} else {
if err := Main(ctx); err != nil {
panic(err)
}
}
}
func Recursive(ctx context.Context) error {
return io.EOF
}
func Main(ctx context.Context) error {
flags := flag.NewFlagSet(os.Args[0], flag.ContinueOnError)
overridesS := flags.String("c", `{"title":"","season":"","episode":""}`, "overrides")
ind := flags.String("i", "/dev/null", "in dir")
@ -55,7 +72,7 @@ func main() {
}
}
if err := Run(ctx,
return Run(ctx,
*outd,
*ind,
append(flags.Args(),
@ -63,9 +80,7 @@ func main() {
),
overrides,
mvNLn,
); err != nil {
panic(err)
}
)
}
func Run(ctx context.Context, outd, ind string, patterns []string, overrides Fields, mvNLn MvNLn) error {