repos / pico

pico services - prose.sh, pastes.sh, imgs.sh, feeds.sh, pgs.sh
git clone https://github.com/picosh/pico.git

commit
37cc0bc
parent
35fb876
author
Eric Bower
date
2024-06-26 17:48:44 +0000 UTC
fix(pgs): when removing project, always try to remove objects
1 files changed,  +6, -6
M pgs/cli.go
+6, -6
 1@@ -479,8 +479,8 @@ func (c *Cmd) prune(prefix string, keepNumLatest int) error {
 2 
 3 	goodbye := rmProjects
 4 	if keepNumLatest > 0 {
 5-		max := len(rmProjects) - (keepNumLatest)
 6-		if max <= 0 {
 7+		pmax := len(rmProjects) - (keepNumLatest)
 8+		if pmax <= 0 {
 9 			out := fmt.Sprintf(
10 				"no projects available to prune (retention policy: %d, total: %d)",
11 				keepNumLatest,
12@@ -489,7 +489,7 @@ func (c *Cmd) prune(prefix string, keepNumLatest int) error {
13 			c.output(out)
14 			return nil
15 		}
16-		goodbye = rmProjects[:max]
17+		goodbye = rmProjects[:pmax]
18 	}
19 
20 	for _, project := range goodbye {
21@@ -547,11 +547,11 @@ func (c *Cmd) rm(projectName string) error {
22 			}
23 		}
24 	} else {
25-		e := fmt.Errorf("(%s) project not found for user (%s)", projectName, c.User.Name)
26-		return e
27+		msg := fmt.Sprintf("(%s) project record not found for user (%s)", projectName, c.User.Name)
28+		c.output(msg)
29 	}
30 
31-	err = c.RmProjectAssets(project.Name)
32+	err = c.RmProjectAssets(projectName)
33 	return err
34 }
35