Rename project to git-project-manager
All checks were successful
Build and Publish / release (push) Successful in 1m10s

This commit is contained in:
2024-12-27 17:42:44 -05:00
parent 9dd38317b8
commit c78c41f567
51 changed files with 353 additions and 309 deletions

View File

@ -7,10 +7,11 @@ import (
"time"
"github.com/pterm/pterm"
"gopkg.in/yaml.v3"
"gitea.libretechconsulting.com/rmcguire/git-project-manager/internal/config"
"gitea.libretechconsulting.com/rmcguire/git-project-manager/internal/remotes"
"gitea.libretechconsulting.com/rmcguire/git-project-manager/internal/remotes/projects"
"gopkg.in/yaml.v3"
)
type Cache struct {
@ -65,7 +66,7 @@ func (c *Cache) LockCache() {
c.log.Info("Attempting to lock cache")
c.checkLock()
file, err := os.OpenFile(c.file+".lock", os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0640)
file, err := os.OpenFile(c.file+".lock", os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0o640)
defer file.Close()
if err != nil {
@ -81,7 +82,7 @@ func (c *Cache) checkLock() {
// Saves the current state of the cache to disk
func (c *Cache) write() {
file, err := os.OpenFile(c.file, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0640)
file, err := os.OpenFile(c.file, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0o640)
if err != nil {
c.log.Error("Failed to write cache to disk", c.log.Args("error", err))
}
@ -92,6 +93,7 @@ func (c *Cache) write() {
c.log.Debug("Cache saved to disk")
}
}
func (c *Cache) Write() {
c.lock.Lock()
defer c.lock.Unlock()
@ -132,6 +134,7 @@ func (c *Cache) clear(clearAliases bool) {
}
c.setUpdated()
}
func (c *Cache) Clear(clearAliases bool) {
c.lock.Lock()
defer c.lock.Unlock()
@ -148,7 +151,7 @@ func (c *Cache) refresh(remotes ...string) {
c.LoadRemotes(remotes...)
}
// Iterates through all GitLab projects the user has access to, updating
// Iterates through all Git projects the user has access to, updating
// the project cache where necessary
func (c *Cache) Refresh(remotes ...string) {
c.lock.Lock()
@ -210,5 +213,5 @@ func NewProjectCache(opts *CacheOpts) (*Cache, error) {
}
func createProjectCache(path string) error {
return os.WriteFile(path, nil, 0640)
return os.WriteFile(path, nil, 0o640)
}