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 {
|
||||
modsdir, infile, outfile string
|
||||
mods modlist.Modlist
|
||||
clobber bool
|
||||
clobber, addmissing bool
|
||||
}
|
||||
|
||||
var cfg config
|
||||
|
@ -73,6 +73,12 @@ func main() {
|
|||
Required: false,
|
||||
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 {
|
||||
// Setup logger
|
||||
|
@ -86,6 +92,7 @@ func main() {
|
|||
|
||||
// Bool flags
|
||||
cfg.clobber = ctx.Bool("clobber")
|
||||
cfg.addmissing = !ctx.Bool("no-add-missing")
|
||||
|
||||
// Deal with in/out file
|
||||
var in = ctx.String("infile")
|
||||
|
@ -116,10 +123,13 @@ func main() {
|
|||
return err
|
||||
}
|
||||
|
||||
err = modlist.AddModsNotInList(cfg.modsdir, &cfg.mods)
|
||||
if err != nil {
|
||||
return err
|
||||
if cfg.addmissing {
|
||||
err = modlist.AddModsNotInList(cfg.modsdir, &cfg.mods)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
selected, err := prompt.Show(&cfg.mods)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
|
Loading…
Reference in a new issue