@@ -20,7 +20,6 @@ import (
20
20
"github.com/fatih/color"
21
21
"github.com/k8sgpt-ai/k8sgpt/pkg/cache"
22
22
"github.com/spf13/cobra"
23
- "github.com/spf13/viper"
24
23
)
25
24
26
25
// removeCmd represents the remove command
@@ -30,27 +29,11 @@ var removeCmd = &cobra.Command{
30
29
Long : `This command allows you to remove the remote cache and use the default filecache.` ,
31
30
Run : func (cmd * cobra.Command , args []string ) {
32
31
33
- // Remove the remote cache
34
- var cacheInfo cache.CacheProvider
35
- err := viper .UnmarshalKey ("cache" , & cacheInfo )
32
+ err := cache .RemoveRemoteCache (bucketname )
36
33
if err != nil {
37
34
color .Red ("Error: %v" , err )
38
35
os .Exit (1 )
39
36
}
40
- if cacheInfo .BucketName == "" {
41
- color .Yellow ("Error: no cache is configured" )
42
- os .Exit (1 )
43
- }
44
- // Warn user this will delete the S3 bucket and prompt them to continue
45
- color .Yellow ("Warning: this will not delete the S3 bucket %s" , cacheInfo .BucketName )
46
- cacheInfo = cache.CacheProvider {}
47
- viper .Set ("cache" , cacheInfo )
48
- err = viper .WriteConfig ()
49
- if err != nil {
50
- color .Red ("Error: %v" , err )
51
- os .Exit (1 )
52
- }
53
-
54
37
color .Green ("Successfully removed the remote cache" )
55
38
},
56
39
}
0 commit comments