feat: add cli flags
This commit is contained in:
15
cli/purge.go
15
cli/purge.go
@@ -1,10 +1,7 @@
|
||||
package cli
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
npmproxy "github.com/emeralt/npm-cache-proxy/proxy"
|
||||
"github.com/go-redis/redis"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
@@ -13,13 +10,11 @@ var purgeCmd = &cobra.Command{
|
||||
Use: "purge",
|
||||
Short: "Purge all cached packages",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
proxy := npmproxy.Proxy{
|
||||
RedisClient: redis.NewClient(&redis.Options{}),
|
||||
HttpClient: &http.Client{
|
||||
Transport: http.DefaultTransport,
|
||||
},
|
||||
GetOptions: getOptions,
|
||||
}
|
||||
proxy := getProxy(func() (npmproxy.Options, error) {
|
||||
return npmproxy.Options{
|
||||
RedisPrefix: persistentOptions.RedisPrefix,
|
||||
}, nil
|
||||
})
|
||||
|
||||
err := proxy.PurgeMetadata()
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user