()
| 31 | ) |
| 32 | |
| 33 | func init() { |
| 34 | maddycli.AddSubcommand( |
| 35 | &cli.Command{ |
| 36 | Name: "imap-acct", |
| 37 | Usage: "IMAP storage accounts management", |
| 38 | Description: `These subcommands can be used to list/create/delete IMAP storage |
| 39 | accounts for any storage backend supported by maddy. |
| 40 | |
| 41 | The corresponding storage backend should be configured in maddy.conf and be |
| 42 | defined in a top-level configuration block. By default, the name of that |
| 43 | block should be local_mailboxes but this can be changed using --cfg-block |
| 44 | flag for subcommands. |
| 45 | |
| 46 | Note that in default configuration it is not enough to create an IMAP storage |
| 47 | account to grant server access. Additionally, user credentials should |
| 48 | be created using 'creds' subcommand. |
| 49 | `, |
| 50 | Subcommands: []*cli.Command{ |
| 51 | { |
| 52 | Name: "list", |
| 53 | Usage: "List storage accounts", |
| 54 | Flags: []cli.Flag{ |
| 55 | &cli.StringFlag{ |
| 56 | Name: "cfg-block", |
| 57 | Usage: "Module configuration block to use", |
| 58 | EnvVars: []string{"MADDY_CFGBLOCK"}, |
| 59 | Value: "local_mailboxes", |
| 60 | }, |
| 61 | }, |
| 62 | Action: func(ctx *cli.Context) error { |
| 63 | be, err := openStorage(ctx) |
| 64 | if err != nil { |
| 65 | return err |
| 66 | } |
| 67 | defer closeIfNeeded(be) |
| 68 | return imapAcctList(be, ctx) |
| 69 | }, |
| 70 | }, |
| 71 | { |
| 72 | Name: "create", |
| 73 | Usage: "Create IMAP storage account", |
| 74 | Description: `In addition to account creation, this command |
| 75 | creates a set of default folder (mailboxes) with special-use attribute set.`, |
| 76 | ArgsUsage: "USERNAME", |
| 77 | Flags: []cli.Flag{ |
| 78 | &cli.StringFlag{ |
| 79 | Name: "cfg-block", |
| 80 | Usage: "Module configuration block to use", |
| 81 | EnvVars: []string{"MADDY_CFGBLOCK"}, |
| 82 | Value: "local_mailboxes", |
| 83 | }, |
| 84 | &cli.BoolFlag{ |
| 85 | Name: "no-specialuse", |
| 86 | Usage: "Do not create special-use folders", |
| 87 | Value: false, |
| 88 | }, |
| 89 | &cli.StringFlag{ |
| 90 | Name: "sent-name", |
nothing calls this directly
no test coverage detected