safing-portmaster/cmds/updatemgr/purge.go
Daniel 47aec76a45 Move the dist dir to a flag and auto-detect it
Also, rename update to release
2020-12-22 13:23:05 +01:00

33 lines
557 B
Go

package main
import (
"fmt"
"github.com/spf13/cobra"
"github.com/safing/portbase/log"
)
func init() {
rootCmd.AddCommand(purgeCmd)
}
var purgeCmd = &cobra.Command{
Use: "purge",
Short: "Remove old resource versions that are superseded by at least three versions",
RunE: purge,
}
func purge(cmd *cobra.Command, args []string) error {
log.SetLogLevel(log.TraceLevel)
err := log.Start()
if err != nil {
fmt.Printf("failed to start logging: %s\n", err)
}
defer log.Shutdown()
registry.SelectVersions()
registry.Purge(3)
return nil
}