implmented cfg command
This commit is contained in:
@@ -18,10 +18,18 @@ type ArtCmd struct {
|
||||
OutputDirectory string `arg:"--output,-o" help:"where to download art files" default:"."`
|
||||
}
|
||||
|
||||
type CfgCmd struct {
|
||||
Files []string `arg:"positional,required"`
|
||||
OutputDirectory string `arg:"--output,-o" help:"where to download cfg files" default:"."`
|
||||
Override bool `arg:"-f,--force" help:"Override existing cfg files"`
|
||||
Append bool `arg:"-a,--append" help:"Append to existing cfg files"`
|
||||
}
|
||||
|
||||
type args struct {
|
||||
Scan *ScanCmd `arg:"subcommand:scan"`
|
||||
Rename *RenameCmd `arg:"subcommand:rename"`
|
||||
Art *ArtCmd `arg:"subcommand:art"`
|
||||
Cfg *CfgCmd `arg:"subcommand:cfg"`
|
||||
}
|
||||
|
||||
func Run() {
|
||||
@@ -35,6 +43,22 @@ func Run() {
|
||||
oplcli.Rename(args.Rename.Files, oplcli.Config{})
|
||||
case args.Art != nil:
|
||||
oplcli.DownloadGameArt(args.Art.Files, args.Art.OutputDirectory, oplcli.Config{})
|
||||
case args.Cfg != nil:
|
||||
if args.Cfg.Override && args.Cfg.Append {
|
||||
p.FailSubcommand("Can only append or override cfg files", "cfg")
|
||||
}
|
||||
|
||||
var mode oplcli.FileMode = oplcli.ModeOnlyCreate
|
||||
|
||||
if args.Cfg.Append {
|
||||
mode = oplcli.ModeAppend
|
||||
}
|
||||
|
||||
if args.Cfg.Override {
|
||||
mode = oplcli.ModeOverride
|
||||
}
|
||||
|
||||
oplcli.DownloadCfg(args.Cfg.Files, args.Cfg.OutputDirectory, mode, oplcli.Config{})
|
||||
default:
|
||||
p.Fail("Must specify command")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user