diff --git a/cmd/apply.go b/cmd/apply.go index f1c14b6..56c6cda 100644 --- a/cmd/apply.go +++ b/cmd/apply.go @@ -1,14 +1,40 @@ package cmd import ( + "github.com/satisfactorymodding/ficsit-cli/cli" "github.com/spf13/cobra" ) var applyCmd = &cobra.Command{ - Use: "apply", + Use: "apply [installation] ...", Short: "Apply profiles to all installations", RunE: func(cmd *cobra.Command, args []string) error { - // TODO + global, err := cli.InitCLI() + if err != nil { + return err + } + + for _, installation := range global.Installations.Installations { + if len(args) > 0 { + found := false + + for _, installPath := range args { + if installation.Path == installPath { + found = true + break + } + } + + if !found { + continue + } + } + + if err := installation.Install(global, nil); err != nil { + return err + } + } + return nil }, }