package cmd import ( "time" "github.com/spf13/cobra" "github.com/spf13/viper" "gitlab.sweetwater.com/it/devops/tools/gitlab-project-manager/internal/projects" ) var cache *projects.Cache var cacheCmd = &cobra.Command{ Use: "cache", Aliases: []string{"a", "ln"}, Short: "Manage GitLab project cache", Long: cacheCmdLong, } func runCacheCmd(cmd *cobra.Command, args []string) { initProjectCache(cmd, args) cache.LockCache() } func postCacheCmd(cmd *cobra.Command, args []string) { postProjectCache(cmd, args) cache.UnlockCache() } func init() { rootCmd.AddCommand(cacheCmd) cacheCmd.PersistentFlags().Duration("ttl", 48*time.Hour, "Duration before cache is re-built in go time.Duration format") viper.BindPFlags(cacheCmd.Flags()) }