28 lines
546 B
Go
28 lines
546 B
Go
package cmd
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/spf13/cobra"
|
|
"github.com/spf13/viper"
|
|
)
|
|
|
|
var dumpCmd = &cobra.Command{
|
|
Use: "dump",
|
|
Short: "Dump GitLab project cache",
|
|
Long: `Dumps cache to display`,
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
if conf.Dump.Full {
|
|
fmt.Println(cache.DumpString())
|
|
} else {
|
|
plog.Info(cache.String())
|
|
}
|
|
},
|
|
}
|
|
|
|
func init() {
|
|
cacheCmd.AddCommand(dumpCmd)
|
|
dumpCmd.PersistentFlags().BoolP("full", "f", false, "Dumps entire cache")
|
|
viper.BindPFlag("dump.full", dumpCmd.LocalFlags().Lookup("full"))
|
|
}
|