(be module.Storage, ctx *cli.Context)
| 483 | } |
| 484 | |
| 485 | func mboxesRemove(be module.Storage, ctx *cli.Context) error { |
| 486 | username := ctx.Args().First() |
| 487 | if username == "" { |
| 488 | return cli.Exit("Error: USERNAME is required", 2) |
| 489 | } |
| 490 | name := ctx.Args().Get(1) |
| 491 | if name == "" { |
| 492 | return cli.Exit("Error: NAME is required", 2) |
| 493 | } |
| 494 | |
| 495 | u, err := be.GetIMAPAcct(username) |
| 496 | if err != nil { |
| 497 | return err |
| 498 | } |
| 499 | |
| 500 | if !ctx.Bool("yes") { |
| 501 | status, err := u.Status(name, []imap.StatusItem{imap.StatusMessages}) |
| 502 | if err != nil { |
| 503 | return err |
| 504 | } |
| 505 | |
| 506 | if status.Messages != 0 { |
| 507 | fmt.Fprintf(os.Stderr, "Mailbox %s contains %d messages.\n", name, status.Messages) |
| 508 | } |
| 509 | |
| 510 | if !clitools2.Confirmation("Are you sure you want to delete that mailbox?", false) { |
| 511 | return errors.New("Cancelled") |
| 512 | } |
| 513 | } |
| 514 | |
| 515 | return u.DeleteMailbox(name) |
| 516 | } |
| 517 | |
| 518 | func mboxesRename(be module.Storage, ctx *cli.Context) error { |
| 519 | username := ctx.Args().First() |
no test coverage detected