aboutsummaryrefslogtreecommitdiff
path: root/Main.hs
blob: 1c79c071a384206a101e751d50bc7a87600d79e0 (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
43
44
45
46
47
48
49
50
-- This module is part of Lazymail, a Haskell email client.
--
-- Copyright (C) 2013 Raúl Benencia <rul@kalgan.cc>
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program.  If not, see <http://www.gnu.org/licenses/>.

module Main where

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

import Email
import Maildir
import Screen
import State

parse ["-h"] = usage   >> exit
parse ["-v"] = version >> exit
parse [md]   = do
  putStrLn $ "Maildirs directory: " ++ md
  entryPoint $ initState { initPath = md }  
         
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