40 lines
892 B
Go
40 lines
892 B
Go
package cmd
|
|
|
|
import (
|
|
oplcli "git.kapelle.org/niklas/opl-cli/internal"
|
|
"github.com/alexflint/go-arg"
|
|
)
|
|
|
|
type ScanCmd struct {
|
|
Files []string `arg:"positional,required"`
|
|
}
|
|
|
|
type RenameCmd struct {
|
|
Files []string `arg:"positional,required"`
|
|
}
|
|
|
|
type ArtCmd struct {
|
|
Files []string `arg:"positional,required"`
|
|
OutputDirectory string `arg:"--output,-o" help:"where to download art files" default:"."`
|
|
}
|
|
|
|
type args struct {
|
|
Scan *ScanCmd `arg:"subcommand:scan"`
|
|
Rename *RenameCmd `arg:"subcommand:rename"`
|
|
Art *ArtCmd `arg:"subcommand:art"`
|
|
}
|
|
|
|
func Run() {
|
|
var args args
|
|
arg.MustParse(&args)
|
|
|
|
switch {
|
|
case args.Scan != nil:
|
|
oplcli.Scan(args.Scan.Files, oplcli.Config{})
|
|
case args.Rename != nil:
|
|
oplcli.Rename(args.Rename.Files, oplcli.Config{})
|
|
case args.Art != nil:
|
|
oplcli.DownloadGameArt(args.Art.Files, args.Art.OutputDirectory, oplcli.Config{})
|
|
}
|
|
}
|