2022-06-08 20:56:32 +00:00
|
|
|
package profile
|
|
|
|
|
|
|
|
import (
|
|
|
|
"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(deleteCmd)
|
|
|
|
}
|
|
|
|
|
|
|
|
var deleteCmd = &cobra.Command{
|
|
|
|
Use: "delete <name>",
|
|
|
|
Short: "Delete a profile",
|
|
|
|
Args: cobra.ExactArgs(1),
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
|
|
|
err = global.Profiles.DeleteProfile(args[0])
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
return global.Save()
|
|
|
|
},
|
|
|
|
}
|