github.com/komosa/bug@v0.3.1/bugapp/Close.go (about) 1 package bugapp 2 3 import ( 4 "fmt" 5 "github.com/driusan/bug/bugs" 6 "os" 7 ) 8 9 func Close(args ArgumentList) { 10 // No parameters, print a list of all bugs 11 if len(args) == 0 { 12 fmt.Fprintf(os.Stderr, "Usage: %s close BugID\n\nMust provide an BugID to close as parameter\n", os.Args[0]) 13 return 14 } 15 16 // There were parameters, so show the full description of each 17 // of those issues 18 for _, bugID := range args { 19 if bug, err := bugs.LoadBugByHeuristic(bugID); err == nil { 20 dir := bug.GetDirectory() 21 fmt.Printf("Removing %s\n", dir) 22 os.RemoveAll(string(dir)) 23 } else { 24 fmt.Printf("Could not close bug %s: %s\n", bugID, err) 25 } 26 } 27 }