cmdWorkdirRemove deletes a workdir row. Does not touch the filesystem and does not null out tasks.work_dir.
(args []string)
| 247 | // cmdWorkdirRemove deletes a workdir row. Does not touch the filesystem |
| 248 | // and does not null out tasks.work_dir. |
| 249 | func cmdWorkdirRemove(args []string) int { |
| 250 | fs := flagSet("workdir remove") |
| 251 | if err := fs.Parse(args); err != nil { |
| 252 | return 2 |
| 253 | } |
| 254 | if fs.NArg() != 1 { |
| 255 | fmt.Fprintln(os.Stderr, "error: workdir remove requires exactly one path") |
| 256 | return 2 |
| 257 | } |
| 258 | abs, err := filepath.Abs(fs.Arg(0)) |
| 259 | if err != nil { |
| 260 | fmt.Fprintf(os.Stderr, "error: %v\n", err) |
| 261 | return 1 |
| 262 | } |
| 263 | db, rc := openFlowDBForWorkdir() |
| 264 | if rc != 0 { |
| 265 | return rc |
| 266 | } |
| 267 | defer db.Close() |
| 268 | if _, err := db.Exec("DELETE FROM workdirs WHERE path = ?", abs); err != nil { |
| 269 | fmt.Fprintf(os.Stderr, "error: %v\n", err) |
| 270 | return 1 |
| 271 | } |
| 272 | fmt.Printf("Unregistered workdir %s\n", abs) |
| 273 | return 0 |
| 274 | } |
| 275 | |
| 276 | // cmdWorkdirScan walks a root (or ~/code and ~/work by default) up to 3 |
| 277 | // levels deep, finds .git directories, and either prints candidates or |
no test coverage detected