You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
cointop/cmd/commands/reset.go

30 lines
719 B
Go

package cmd
import (
"github.com/miguelmota/cointop/cointop"
"github.com/miguelmota/cointop/pkg/filecache"
"github.com/spf13/cobra"
)
// ResetCmd ...
func ResetCmd() *cobra.Command {
cacheDir := filecache.DefaultCacheDir
resetCmd := &cobra.Command{
Use: "reset",
Short: "Resets the config and clear the cache",
Long: `The reset command resets the config and clears the cache`,
RunE: func(cmd *cobra.Command, args []string) error {
// NOTE: if reset command, reset but don't run cointop
return cointop.Reset(&cointop.ResetConfig{
Log: true,
CacheDir: cacheDir,
})
},
}
resetCmd.Flags().StringVarP(&cacheDir, "cache-dir", "", cacheDir, "Cache directory")
return resetCmd
}