Add cache maintenance locking

This commit is contained in:
2023-12-10 00:05:39 -05:00
parent 78662b3e09
commit 5d2ca40d04
4 changed files with 36 additions and 4 deletions

View File

@ -23,8 +23,7 @@ func runListAliasCmd(cmd *cobra.Command, args []string) {
WithBoxStyle(&pterm.Style{pterm.FgLightBlue}).
WithTitle(pterm.Bold.Sprint(pterm.LightGreen("Aliases by Project"))).
Print("\n" + cache.AliasesByProjectString())
fmt.Println("\n")
// fmt.Print("\n" + cache.AliasesByProjectString() + "\n")
fmt.Print("\n\n")
}
func init() {

View File

@ -14,16 +14,18 @@ var cacheCmd = &cobra.Command{
Use: "cache",
Short: "Manage GitLab project cache",
Long: cacheCmdLong,
PersistentPreRun: initCacheCmd,
PersistentPreRun: runCacheCmd,
PersistentPostRun: postCacheCmd,
}
func initCacheCmd(cmd *cobra.Command, args []string) {
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() {