ficsit-cli-flake/cmd/profile/mod/remove.go

35 lines
628 B
Go
Raw Normal View History

2022-06-08 20:56:32 +00:00
package mod
import (
"fmt"
"github.com/spf13/cobra"
2022-10-14 16:11:16 +00:00
"github.com/satisfactorymodding/ficsit-cli/cli"
2022-06-08 20:56:32 +00:00
)
func init() {
Cmd.AddCommand(removeCmd)
}
var removeCmd = &cobra.Command{
Use: "remove <profile> <mod-reference>",
Short: "Remove a mod from a profile",
Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
2022-10-14 16:11:16 +00:00
global, err := cli.InitCLI(false)
2022-06-08 20:56:32 +00:00
if err != nil {
return err
}
profile := global.Profiles.GetProfile(args[0])
if profile == nil {
return fmt.Errorf("profile with name %s does not exist", args[0])
}
profile.RemoveMod(args[1])
return global.Save()
},
}