cli args improvements
This commit is contained in:
@@ -6,15 +6,16 @@ import (
|
||||
)
|
||||
|
||||
type ScanCmd struct {
|
||||
Files []string `arg:"positional"`
|
||||
Files []string `arg:"positional,required"`
|
||||
}
|
||||
|
||||
type RenameCmd struct {
|
||||
Files []string `arg:"positional"`
|
||||
Files []string `arg:"positional,required"`
|
||||
}
|
||||
|
||||
type ArtCmd struct {
|
||||
Files []string `arg:"positional"`
|
||||
Files []string `arg:"positional,required"`
|
||||
OutputDirectory string `arg:"--output,-o" help:"where to download art files" default:"."`
|
||||
}
|
||||
|
||||
type args struct {
|
||||
@@ -25,23 +26,14 @@ type args struct {
|
||||
|
||||
func Run() {
|
||||
var args args
|
||||
p := arg.MustParse(&args)
|
||||
arg.MustParse(&args)
|
||||
|
||||
switch {
|
||||
case args.Scan != nil:
|
||||
if len(args.Scan.Files) == 0 {
|
||||
p.Fail("Provide at least one file to scan")
|
||||
}
|
||||
oplcli.Scan(args.Scan.Files, oplcli.Config{})
|
||||
case args.Rename != nil:
|
||||
if len(args.Rename.Files) == 0 {
|
||||
p.Fail("Provide at least one file rename")
|
||||
}
|
||||
oplcli.Rename(args.Rename.Files, oplcli.Config{})
|
||||
case args.Art != nil:
|
||||
if len(args.Art.Files) == 0 {
|
||||
p.Fail("Provide at least one file to download art for")
|
||||
}
|
||||
oplcli.DownloadGameArt(args.Art.Files, oplcli.Config{})
|
||||
oplcli.DownloadGameArt(args.Art.Files, args.Art.OutputDirectory, oplcli.Config{})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user