haunt/cmd/clean.go
abs3nt 32d1074fd9
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
improved: aliases
2023-03-08 13:46:44 -08:00

31 lines
606 B
Go

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