module Highlight.Hrep where

import Options.Applicative
       (InfoMod, ParserInfo, (<**>), execParser, fullDesc, helper, info,
        progDesc)

import Highlight.Common.Options (CommonOptions, commonOptionsParser)
import Highlight.Hrep.Run (run)

defaultMain :: IO ()
defaultMain :: IO ()
defaultMain = do
  CommonOptions
options <- ParserInfo CommonOptions -> IO CommonOptions
forall a. ParserInfo a -> IO a
execParser ParserInfo CommonOptions
parserInfo
  CommonOptions -> IO ()
run CommonOptions
options
  where
    parserInfo :: ParserInfo CommonOptions
    parserInfo :: ParserInfo CommonOptions
parserInfo = Parser CommonOptions
-> InfoMod CommonOptions -> ParserInfo CommonOptions
forall a. Parser a -> InfoMod a -> ParserInfo a
info (Parser CommonOptions
commonOptionsParser Parser CommonOptions
-> Parser (CommonOptions -> CommonOptions) -> Parser CommonOptions
forall (f :: * -> *) a b. Applicative f => f a -> f (a -> b) -> f b
<**> Parser (CommonOptions -> CommonOptions)
forall a. Parser (a -> a)
helper) InfoMod CommonOptions
forall a. InfoMod a
infoMod

    infoMod :: InfoMod a
    infoMod :: InfoMod a
infoMod =
      InfoMod a
forall a. InfoMod a
fullDesc InfoMod a -> InfoMod a -> InfoMod a
forall a. Semigroup a => a -> a -> a
<>
      String -> InfoMod a
forall a. String -> InfoMod a
progDesc String
"Search for PATTERN in each FILE or standard input."