module Sound.Conductive.Main where
import Sound.Conductive.ClockDisplay
import Sound.Conductive.ClockListener
import Graphics.Vty
import System.Console.ParseArgs
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
main = do
args <- parseArgsIO ArgsComplete argumentDefinitions
vt <- mkVty
DisplayRegion w h <- display_bounds $ terminal vt
putStrLn $ show $ DisplayRegion w h
listener (portNumber args) vt