blob: 4cc6ac1101c22aacceb63c2844b1300b857c9293 (
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
33
|
{-# LANGUAGE RecordWildCards #-}
--------------------------------------------------------------------------------
module Main where
--------------------------------------------------------------------------------
import Options.Applicative
import Data.Semigroup ((<>))
import qualified Transforms
import qualified Keyboard
import qualified App
--------------------------------------------------------------------------------
data CommandArgs = CommandArgs
{ transforms :: String
} deriving (Eq, Show)
parseArgs :: Parser CommandArgs
parseArgs =
CommandArgs <$> strOption
( long "transforms"
<> short 't'
<> help "String of transforms where (e.g. \"HHVS12VHVHS3\")" )
main :: IO ()
main = do
CommandArgs{..} <- execParser opts
case Transforms.fromString transforms of
Nothing -> putStrLn "You must provide valid input (e.g. \"HHVS12VHVHS3\")"
Just xs -> print $ foldl App.transform Keyboard.qwerty xs
where
opts = info (parseArgs <**> helper)
( fullDesc
<> progDesc "Transform a QWERTY keyboard using a string of commands")
|