hold
This commit is contained in:
23
main.go
23
main.go
@@ -5,6 +5,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"path"
|
"path"
|
||||||
@@ -25,6 +26,22 @@ func main() {
|
|||||||
ctx, can := signal.NotifyContext(context.Background(), syscall.SIGINT)
|
ctx, can := signal.NotifyContext(context.Background(), syscall.SIGINT)
|
||||||
defer can()
|
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)
|
flags := flag.NewFlagSet(os.Args[0], flag.ContinueOnError)
|
||||||
overridesS := flags.String("c", `{"title":"","season":"","episode":""}`, "overrides")
|
overridesS := flags.String("c", `{"title":"","season":"","episode":""}`, "overrides")
|
||||||
ind := flags.String("i", "/dev/null", "in dir")
|
ind := flags.String("i", "/dev/null", "in dir")
|
||||||
@@ -55,7 +72,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := Run(ctx,
|
return Run(ctx,
|
||||||
*outd,
|
*outd,
|
||||||
*ind,
|
*ind,
|
||||||
append(flags.Args(),
|
append(flags.Args(),
|
||||||
@@ -63,9 +80,7 @@ func main() {
|
|||||||
),
|
),
|
||||||
overrides,
|
overrides,
|
||||||
mvNLn,
|
mvNLn,
|
||||||
); err != nil {
|
)
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func Run(ctx context.Context, outd, ind string, patterns []string, overrides Fields, mvNLn MvNLn) error {
|
func Run(ctx context.Context, outd, ind string, patterns []string, overrides Fields, mvNLn MvNLn) error {
|
||||||
|
|||||||
Reference in New Issue
Block a user