Package subcommand code
This commit is contained in:
34
cmd/cache/cache.go
vendored
Normal file
34
cmd/cache/cache.go
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
var cacheCmd = &cobra.Command{
|
||||
Use: "cache",
|
||||
Aliases: []string{"a", "ln"},
|
||||
Short: "Manage Git project cache",
|
||||
Long: cacheCmdLong,
|
||||
}
|
||||
|
||||
func runCacheCmd(cmd *cobra.Command, args []string) {
|
||||
initProjectCache(cmd, args)
|
||||
projectCache.LockCache()
|
||||
}
|
||||
|
||||
func postCacheCmd(cmd *cobra.Command, args []string) {
|
||||
postProjectCache(cmd, args)
|
||||
projectCache.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())
|
||||
}
|
||||
Reference in New Issue
Block a user