-
Notifications
You must be signed in to change notification settings - Fork 88
/
reset.go
39 lines (28 loc) · 846 Bytes
/
reset.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package cmd
import (
"fmt"
"os"
"github.com/spf13/cobra"
"github.com/spf13/viper"
e "github.com/broadinstitute/warp/wreleaser/pkg/error"
)
// resetCmd represents the reset command
var resetCmd = &cobra.Command{
Use: "reset",
Short: "Clear the directory which caches WARP releases",
Long: `'reset' command clears the directory of cached WARP releases
Usage example:
'wreleaser reset' (clear the default cache located at $HOME/.wreleaser/cache.json)
'wreleaser reset --cachedir=/path/to/custom' (clear the custom cache located at /path/to/custom)`,
Run: func(cmd *cobra.Command, args []string) {
cache := viper.GetString("cachedir")
if err := os.Remove(cache); err != nil {
e.HandleError(err)
os.Exit(1)
}
fmt.Printf("Cache %s deleted", cache)
},
}
func init() {
rootCmd.AddCommand(resetCmd)
}