aboutsummaryrefslogtreecommitdiff
path: root/bin/Main.hs
blob: 03c0904ab5e1552833e5edb9dc519a919553d971 (plain) (blame)
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
module Main where

import qualified Chelleport
import qualified Chelleport.Args as Args
import Chelleport.Types
import qualified System.Environment
import System.Exit (exitFailure)

main :: IO ()
main = do
  args <- System.Environment.getArgs
  case Args.parseArgs args of
    Right config
      | configShowHelp config -> showHelp
      | otherwise -> Chelleport.run config
    Left err -> do
      showHelp
      putStrLn $ "[Error] " ++ err
      exitFailure

showHelp :: IO ()
showHelp =
  putStrLn . unlines $
    [ "Control your mouse with your keyboard",
      "See https://github.com/phenax/chelleport for more information",
      "",
      "Usage: chelleport [FLAGS]",
      "",
      "Flags:",
      "  --help: Help menu. This thing right here",
      "  -m <mode>, --mode <mode>: Run program in mode. (search | hints)"
    ]