From 5d58cc9ac6c26688465b402236e1b7caca7749d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lilian=20J=C3=B3nsd=C3=B3ttir?= Date: Sun, 11 Feb 2024 19:41:57 -0800 Subject: [PATCH] add cli flag to disable automatic addition of missing mods --- cmd/fml/fml.go | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/cmd/fml/fml.go b/cmd/fml/fml.go index 7bb51a2..b120c9b 100644 --- a/cmd/fml/fml.go +++ b/cmd/fml/fml.go @@ -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)