mirror of
https://github.com/mjl-/mox.git
synced 2025-07-10 10:34:40 +03:00
add subcommand "ximport", that is like "import" but directly access files in the datadir
so mox doesn't have to be running when you run it. will be useful for testing in the near future. this also moves cpuprof and memprof cli flags to top-level flag parsing, so all commands can use them.
This commit is contained in:
9
main.go
9
main.go
@ -152,6 +152,8 @@ var commands = []struct {
|
||||
{"updates serve", cmdUpdatesServe},
|
||||
{"updates verify", cmdUpdatesVerify},
|
||||
{"gentestdata", cmdGentestdata},
|
||||
{"ximport maildir", cmdXImportMaildir},
|
||||
{"ximport mbox", cmdXImportMbox},
|
||||
}
|
||||
|
||||
var cmds []cmd
|
||||
@ -391,12 +393,19 @@ func main() {
|
||||
flag.StringVar(&loglevel, "loglevel", "", "if non-empty, this log level is set early in startup")
|
||||
flag.BoolVar(&pedantic, "pedantic", false, "protocol violations result in errors instead of accepting/working around them")
|
||||
|
||||
var cpuprofile, memprofile string
|
||||
flag.StringVar(&cpuprofile, "cpuprof", "", "store cpu profile to file")
|
||||
flag.StringVar(&memprofile, "memprof", "", "store mem profile to file")
|
||||
|
||||
flag.Usage = func() { usage(cmds, false) }
|
||||
flag.Parse()
|
||||
args := flag.Args()
|
||||
if len(args) == 0 {
|
||||
usage(cmds, false)
|
||||
}
|
||||
|
||||
defer profile(cpuprofile, memprofile)()
|
||||
|
||||
if pedantic {
|
||||
moxvar.Pedantic = true
|
||||
}
|
||||
|
Reference in New Issue
Block a user