
  , Option "l" ["localisations"] (NoArg $ \o → o { localisationKeys = True }) "find all localisation keys"
  , Option "t" ["traits"] (NoArg $ \o → o { _traits = True }) "find all referenced traits"
  ]
  <> [ Option "G" ["game-dir"] (ReqArg (\fp o → o { gameRootPath = fp }) "DIR") "folder containing the base game"
     , Option "M" ["mod-dir"] (ReqArg (\fp o → o { modRootPath = Just fp}) "DIR") "folder containing the mod"
     ]
  <> [ Option "h" ["help"] (NoArg $ \o → o { showHelp = True }) "print this message"
     ]

main = do
  (rawArgs,_,_) ← getOpt Permute options <$> getArgs
  let args = foldl' (flip ($)) defaultArgs rawArgs
  when (showHelp args)
    $ Prelude.putSt
options :: [OptDescr (Args → Args)]
options =
  [ Option "s" ["strings"] (NoArg $ \o → o { stringResources = True }) "find all string resources"
  , Option "l" ["localisations"] (NoArg $ \o → o { localisationKeys = True }) "find all localisation keys"
  , Option "t" ["traits"] (NoArg $ \o → o { _traits = True }) "find all referenced traits"
  ]
  <> [ Option "G" ["game-dir"] (ReqArg (\fp o → o { gameRootPath = fp }) "DIR") "folder containing the base game"
     , Option "M" ["mod-dir"] (ReqArg (\fp o → o { modRootPath = Just fp}) "DIR") "folder containing the mod"
     ]
  <> [ Option "h" ["help"] (NoArg $ \o → o { showHelp = True }) "print this message"
     ]
options =
  [ Option "s" ["strings"] (NoArg $ \o → o { stringResources = True }) "find all string resources"
  , Option "l" ["localisations"] (NoArg $ \o → o { localisationKeys = True }) "find all localisation keys"
  , Option "t" ["traits"] (NoArg $ \o → o { _traits = True }) "find all referenced traits"
  ]
  <> [ Option "G" ["game-dir"] (ReqArg (\fp o → o { gameRootPath = fp }) "DIR") "folder containing the base game"
     , Option "M" ["mod-dir"] (ReqArg (\fp o → o { modRootPath = Just fp}) "DIR") "folder containing the mod"
     ]
  <> [ Option "h" ["help"] (NoArg $ \o → o { showHelp = True }) "print this message"
     ]