{- |
Module      :  Highlight.Highlight

Copyright   :  Dennis Gosnell 2017
License     :  BSD3

Maintainer  :  Dennis Gosnell (cdep.illabout@gmail.com)
Stability   :  experimental
Portability :  unknown

This module contains the 'defaultMain' function for the @highlight@ program.
-}

module Highlight.Highlight where

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

import Highlight.Highlight.Options (Options, optionsParser)
import Highlight.Highlight.Run (run)

defaultMain :: IO ()
defaultMain :: IO ()
defaultMain = do
  Options
options <- ParserInfo Options -> IO Options
forall a. ParserInfo a -> IO a
execParser ParserInfo Options
parserInfo
  Options -> IO ()
run Options
options
  where
    parserInfo :: ParserInfo Options
    parserInfo :: ParserInfo Options
parserInfo = Parser Options -> InfoMod Options -> ParserInfo Options
forall a. Parser a -> InfoMod a -> ParserInfo a
info (Parser Options
optionsParser Parser Options -> Parser (Options -> Options) -> Parser Options
forall (f :: * -> *) a b. Applicative f => f a -> f (a -> b) -> f b
<**> Parser (Options -> Options)
forall a. Parser (a -> a)
helper) InfoMod Options
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
"Highlight PATTERN in a each FILE or standard input"