------------------------------------------------------------------------------ -- Main.hs -- created: Mon Aug 30 15:20:05 JST 2010 ------------------------------------------------------------------------------ module Sound.Conductive.Main where import Sound.Conductive.ClockDisplay import Sound.Conductive.ClockListener import Graphics.Vty import System.Console.ParseArgs -- import System.IO data ClockDisplayArg = Port deriving (Ord, Eq, Show) argumentDefinitions :: [ Arg ClockDisplayArg ] argumentDefinitions = [ Arg { argIndex = Port , argName = Just "port" , argAbbr = Just 'p' , argData = argDataRequired "port" ArgtypeString , argDesc = "the port number which the clock display is listening at" } ] portNumber :: Args ClockDisplayArg -> Int portNumber args = read $ getRequiredArg args Port -- launch the program with a -p argument for the port number main = do args <- parseArgsIO ArgsComplete argumentDefinitions vt <- mkVty DisplayRegion w h <- display_bounds $ terminal vt putStrLn $ show $ DisplayRegion w h listener (portNumber args) vt