ficsit-cli-flake/cmd/apply.go

41 lines
721 B
Go
Raw Normal View History

2022-06-08 20:56:32 +00:00
package cmd
import (
2022-06-11 01:01:51 +00:00
"github.com/satisfactorymodding/ficsit-cli/cli"
2022-06-08 20:56:32 +00:00
"github.com/spf13/cobra"
)
var applyCmd = &cobra.Command{
2022-06-11 01:01:51 +00:00
Use: "apply [installation] ...",
2022-06-08 20:56:32 +00:00
Short: "Apply profiles to all installations",
RunE: func(cmd *cobra.Command, args []string) error {
2022-06-11 01:01:51 +00:00
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
}
}
2022-06-08 20:56:32 +00:00
return nil
},
}