hmonitors/app/Main.hs

25 lines
615 B
Haskell
Raw Normal View History

2020-11-04 17:12:03 +01:00
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
2021-08-04 20:56:11 +02:00
usage = printf "%s bat | vol | net | date" <$> getProgName
2020-11-04 17:12:03 +01:00
main :: IO ()
main = do
args <- getArgs
output <- case args of
2021-08-04 20:56:11 +02:00
[ "bat", cmd ] -> queryBattery cmd
[ "vol", cmd ] -> queryVolume cmd
[ "net", cmd ] -> queryNet cmd
2020-11-04 17:12:03 +01:00
[ "date" ] -> queryDate True
[ "date-min" ] -> queryDate False
_ -> usage
putStrLn output