git-project-manager/cmd/cache_load.go

29 lines
640 B
Go
Raw Normal View History

2023-12-04 21:53:01 +00:00
package cmd
import (
"github.com/spf13/cobra"
2023-12-10 04:19:19 +00:00
"github.com/spf13/viper"
2023-12-04 21:53:01 +00:00
)
var loadCmd = &cobra.Command{
Use: "load",
2023-12-05 21:56:47 +00:00
Short: "Load GitLab Project Cache",
Long: `Used to initialize or update a new GitLab cache. With thousands
of projects, it would be too much work to hit the API every time a user
wants to find a new project.`,
2023-12-07 17:08:56 +00:00
Run: loadCache,
}
func loadCache(cmd *cobra.Command, args []string) {
cache.Refresh()
2023-12-04 21:53:01 +00:00
}
func init() {
cacheCmd.AddCommand(loadCmd)
2023-12-10 04:19:19 +00:00
loadCmd.PersistentFlags().Bool("ownerOnly", true,
"Only load projects that you are owner of")
viper.BindPFlag("cache.load.ownerOnly", loadCmd.Flag("ownerOnly"))
2023-12-04 21:53:01 +00:00
}