func runProjectClean(jirix *jiri.X, args []string) (e error) { localProjects, err := project.LocalProjects(jirix, project.FullScan) if err != nil { return err } var projects project.Projects if len(args) > 0 { for _, arg := range args { p, err := localProjects.FindUnique(arg) if err != nil { fmt.Fprintf(jirix.Stderr(), "Error finding local project %q: %v.\n", p.Name, err) } else { projects[p.Key()] = p } } } else { projects = localProjects } if err := project.CleanupProjects(jirix, projects, cleanupBranchesFlag); err != nil { return err } return nil }
func runProjectClean(env *cmdline.Env, args []string) (e error) { ctx := tool.NewContextFromEnv(env) localProjects, err := project.LocalProjects(ctx, project.FullScan) if err != nil { return err } projects := map[string]project.Project{} if len(args) > 0 { for _, arg := range args { if p, ok := localProjects[arg]; ok { projects[p.Name] = p } else { fmt.Fprintf(ctx.Stderr(), "Local project %q not found.\n", p.Name) } } } else { projects = localProjects } if err := project.CleanupProjects(ctx, projects, cleanupBranchesFlag); err != nil { return err } return nil }