1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- package main
- import (
- "os"
- scanner "./scanner"
- web "./web"
- )
- type GofixEngine struct {
- scanner *scanner.MailScanner
- web *web.Server
- }
- func NewGofixEngine(mailPath string) (e *GofixEngine) {
- e = &GofixEngine{
- scanner: scanner.NewMailScanner(mailPath),
- web: web.NewServer(mailPath),
- }
- return
- }
- func (e *GofixEngine) Run() {
- defer e.scanner.Stop()
- e.scanner.Run()
- e.web.Run()
- }
- func main() {
- mailPath := "."
- if len(os.Args) >= 2 {
- mailPath = os.Args[1]
- }
- engine := NewGofixEngine(mailPath)
- engine.Run()
- }
|