aboutsummaryrefslogtreecommitdiff
path: root/Main.hs
blob: ebc4810e242186e89baaf6f69aa1a97e6ab31c0c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
{- Main module
 -
 - Copyright 2013 Raúl Benencia <rul@kalgan.cc>
 -
 - Licensed under the GNU GPL version 3 or higher
 -
 -}

module Main (main) where

import System.Environment
import System.Exit
import System.FilePath(takeDirectory)

import Lazymail
import Email
import Maildir
import Screen
import State

parse ["-h"] = usage   >> exit
parse ["-v"] = version >> exit
parse [md]   = do
  putStrLn $ "Maildirs directory: " ++ md
  run entryPoint

parse [] = usage >> die

usage   = putStrLn . unlines $ usageText where
  usageText = ["Usage: ./Main [-vh] <maildirs>"
              ,"      where <maildirs> is a directory with Maildirs, or a Maildir itself."
              ,"      Lazymail will recursively search for Maildirs. "]

version = putStrLn "Haskell lazymail 0.0001"
exit    = exitWith ExitSuccess
die     = exitWith (ExitFailure 1)

main :: IO ()
main = do
  args <- getArgs
  parse args
  putStrLn "Game over!"
nihil fit ex nihilo