mox retrain: make the parameter, for account, optional and retrain all accounts when absent

for more easily retraining all accounts. users should be retraining their
accounts with the next release, due to the fix in the previous commit.
This commit is contained in:
Mechiel Lukkien
2024-12-07 17:00:00 +01:00
parent 17baf9a883
commit 94fb48c2dc
3 changed files with 74 additions and 59 deletions

12
main.go
View File

@ -2874,19 +2874,23 @@ should be used, and how long the policy can be cached.
}
func cmdRetrain(c *cmd) {
c.params = "accountname"
c.help = `Recreate and retrain the junk filter for the account.
c.params = "[accountname]"
c.help = `Recreate and retrain the junk filter for the account or all accounts.
Useful after having made changes to the junk filter configuration, or if the
implementation has changed.
`
args := c.Parse()
if len(args) != 1 {
if len(args) > 1 {
c.Usage()
}
var account string
if len(args) == 1 {
account = args[0]
}
mustLoadConfig()
ctlcmdRetrain(xctl(), args[0])
ctlcmdRetrain(xctl(), account)
}
func ctlcmdRetrain(ctl *ctl, account string) {