gomanager/cmd/clean.go

36 lines
845 B
Go

package cmd
import (
"os"
"runtime"
"github.com/spf13/cobra"
)
// cleanCmd represents the clean command
var cleanCmd = &cobra.Command{
Use: "clean",
Short: "Cleans the gomanager database",
RunE: func(cmd *cobra.Command, args []string) error {
runtime.GOMAXPROCS(1)
if e := os.Remove(sqliteFilename); e != nil {
return e
}
return os.Remove("/var/lib/gomanager")
},
}
func init() {
rootCmd.AddCommand(cleanCmd)
// Here you will define your flags and configuration settings.
// Cobra supports Persistent Flags which will work for this command
// and all subcommands, e.g.:
// cleanCmd.PersistentFlags().String("foo", "", "A help for foo")
// Cobra supports local flags which will only run when this command
// is called directly, e.g.:
// cleanCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
}