Package subcommand code

This commit is contained in:
2024-12-30 14:54:32 -05:00
parent 888ee5ea4a
commit 96378d047e
19 changed files with 564 additions and 412 deletions

34
cmd/cache/cache.go vendored Normal file
View 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())
}