aboutsummaryrefslogtreecommitdiff
path: root/bin/Main.hs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--bin/Main.hs28
1 files changed, 27 insertions, 1 deletions
diff --git a/bin/Main.hs b/bin/Main.hs
index ebc9a39..007fb5e 100644
--- a/bin/Main.hs
+++ b/bin/Main.hs
@@ -1,6 +1,32 @@
module Main where
import qualified Chelleport
+import Chelleport.Args (Configuration (configShowHelp))
+import qualified Chelleport.Args as Args
+import qualified System.Environment
+import System.Exit (exitFailure)
main :: IO ()
-main = Chelleport.run
+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)"
+ ]