add cli flag to disable automatic addition of missing mods
This commit is contained in:
parent
0da517f531
commit
5d58cc9ac6
|
@ -16,7 +16,7 @@ import (
|
||||||
type config struct {
|
type config struct {
|
||||||
modsdir, infile, outfile string
|
modsdir, infile, outfile string
|
||||||
mods modlist.Modlist
|
mods modlist.Modlist
|
||||||
clobber bool
|
clobber, addmissing bool
|
||||||
}
|
}
|
||||||
|
|
||||||
var cfg config
|
var cfg config
|
||||||
|
@ -73,6 +73,12 @@ func main() {
|
||||||
Required: false,
|
Required: false,
|
||||||
Usage: "overwrite specified infile",
|
Usage: "overwrite specified infile",
|
||||||
},
|
},
|
||||||
|
&cli.BoolFlag{
|
||||||
|
Name: "no-add-missing",
|
||||||
|
Aliases: []string{"m"},
|
||||||
|
Required: false,
|
||||||
|
Usage: "don't automatically add mods missing from infile",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
Before: func(ctx *cli.Context) error {
|
Before: func(ctx *cli.Context) error {
|
||||||
// Setup logger
|
// Setup logger
|
||||||
|
@ -86,6 +92,7 @@ func main() {
|
||||||
|
|
||||||
// Bool flags
|
// Bool flags
|
||||||
cfg.clobber = ctx.Bool("clobber")
|
cfg.clobber = ctx.Bool("clobber")
|
||||||
|
cfg.addmissing = !ctx.Bool("no-add-missing")
|
||||||
|
|
||||||
// Deal with in/out file
|
// Deal with in/out file
|
||||||
var in = ctx.String("infile")
|
var in = ctx.String("infile")
|
||||||
|
@ -116,10 +123,13 @@ func main() {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if cfg.addmissing {
|
||||||
err = modlist.AddModsNotInList(cfg.modsdir, &cfg.mods)
|
err = modlist.AddModsNotInList(cfg.modsdir, &cfg.mods)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
selected, err := prompt.Show(&cfg.mods)
|
selected, err := prompt.Show(&cfg.mods)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
|
|
Loading…
Reference in a new issue