summaryrefslogtreecommitdiff
path: root/diddohs.hs
blob: fdc1d0d73bd0244fb1e70c9b78ff885bb7d138bb (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
import System.Environment
import System.IO
import Options.Applicative
import Data.Time

data Args = Args
  { entry :: String
--  , time :: Time
--  , verbose :: Bool
--  , file :: String
}

runWithOptions :: Args -> IO ()
runWithOptions opts =
  putStrLn ( entry opts ++ " saved." )

main :: IO ()
main = execParser opts >>= runWithOptions
  where
    parser = Args <$> argument str (metavar "ENTRY")
    opts = info parser mempty

-- main = getArgs >>= parse

-- parse [] = getLine >>= saveActivity "actlog.txt"
-- parse ["add"] = getLine >>= saveActivity "actlog.txt"
-- parse ["new"] = getLine >>= saveActivity "actlog.txt"
-- parse ("add":entry) = saveActivity "actlog.txt" $ unwords entry
-- parse ("new":entry) = saveActivity "actlog.txt" $ unwords entry
-- parse ("-f":

-- saveActivity file act = do
--   zoneTime <- fmap show Data.Time.getZonedTime
--   appendFile "actlog.txt" (zoneTime ++ "\t" ++ act ++ "\n")
--   hPutStrLn stderr ("\"" ++ zoneTime ++ "\t" ++ act ++ "\"" ++ " saved.")