hmonitors/app/Main.hs

25 lines
615 B
Haskell

module Main where
import Text.Printf
import System.Environment
import Monitors.Battery (queryBattery)
import Monitors.Date (queryDate)
import Monitors.Net (queryNet)
import Monitors.Volume (queryVolume)
usage :: IO String
usage = printf "%s bat | vol | net | date" <$> getProgName
main :: IO ()
main = do
args <- getArgs
output <- case args of
[ "bat", cmd ] -> queryBattery cmd
[ "vol", cmd ] -> queryVolume cmd
[ "net", cmd ] -> queryNet cmd
[ "date" ] -> queryDate True
[ "date-min" ] -> queryDate False
_ -> usage
putStrLn output