()
| 36 | ) |
| 37 | |
| 38 | func init() { |
| 39 | maddycli.AddSubcommand( |
| 40 | &cli.Command{ |
| 41 | Name: "imap-mboxes", |
| 42 | Usage: "IMAP mailboxes (folders) management", |
| 43 | Subcommands: []*cli.Command{ |
| 44 | { |
| 45 | Name: "list", |
| 46 | Usage: "Show mailboxes of user", |
| 47 | ArgsUsage: "USERNAME", |
| 48 | Flags: []cli.Flag{ |
| 49 | &cli.StringFlag{ |
| 50 | Name: "cfg-block", |
| 51 | Usage: "Module configuration block to use", |
| 52 | EnvVars: []string{"MADDY_CFGBLOCK"}, |
| 53 | Value: "local_mailboxes", |
| 54 | }, |
| 55 | &cli.BoolFlag{ |
| 56 | Name: "subscribed", |
| 57 | Aliases: []string{"s"}, |
| 58 | Usage: "List only subscribed mailboxes", |
| 59 | }, |
| 60 | }, |
| 61 | Action: func(ctx *cli.Context) error { |
| 62 | be, err := openStorage(ctx) |
| 63 | if err != nil { |
| 64 | return err |
| 65 | } |
| 66 | defer closeIfNeeded(be) |
| 67 | return mboxesList(be, ctx) |
| 68 | }, |
| 69 | }, |
| 70 | { |
| 71 | Name: "create", |
| 72 | Usage: "Create mailbox", |
| 73 | ArgsUsage: "USERNAME NAME", |
| 74 | Flags: []cli.Flag{ |
| 75 | &cli.StringFlag{ |
| 76 | Name: "cfg-block", |
| 77 | Usage: "Module configuration block to use", |
| 78 | EnvVars: []string{"MADDY_CFGBLOCK"}, |
| 79 | Value: "local_mailboxes", |
| 80 | }, |
| 81 | &cli.StringFlag{ |
| 82 | Name: "special", |
| 83 | Usage: "Set SPECIAL-USE attribute on mailbox; valid values: archive, drafts, junk, sent, trash", |
| 84 | }, |
| 85 | }, |
| 86 | Action: func(ctx *cli.Context) error { |
| 87 | be, err := openStorage(ctx) |
| 88 | if err != nil { |
| 89 | return err |
| 90 | } |
| 91 | defer closeIfNeeded(be) |
| 92 | return mboxesCreate(be, ctx) |
| 93 | }, |
| 94 | }, |
| 95 | { |
nothing calls this directly
no test coverage detected