2023-03-04 22:22:03 +00:00
|
|
|
package cmd
|
|
|
|
|
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
|
|
|
|
"github.com/abs3ntdev/haunt/src/haunt"
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
)
|
|
|
|
|
|
|
|
// cleanCmd represents the clean command
|
|
|
|
var cleanCmd = &cobra.Command{
|
2023-03-08 21:46:44 +00:00
|
|
|
Use: "clean",
|
|
|
|
Aliases: []string{"c"},
|
|
|
|
Short: "Deletes the haunt config file",
|
|
|
|
RunE: clean,
|
2023-03-04 22:22:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
rootCmd.AddCommand(cleanCmd)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Clean remove haunt file
|
|
|
|
func clean(cmd *cobra.Command, args []string) (err error) {
|
2023-03-06 07:39:01 +00:00
|
|
|
h := haunt.NewHaunt()
|
|
|
|
if err := h.Settings.Remove(haunt.HFile); err != nil {
|
2023-03-04 22:22:03 +00:00
|
|
|
return err
|
|
|
|
}
|
2023-03-06 07:39:01 +00:00
|
|
|
log.Println(h.Prefix(haunt.Green.Bold("config file removed successfully removed")))
|
2023-03-04 22:22:03 +00:00
|
|
|
return nil
|
|
|
|
}
|