blob: 784bf81f20c7f1fbc82ff84291434c85caa3524d (
plain)
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
|
{-# LANGUAGE ApplicativeDo #-}
{-# LANGUAGE RecordWildCards #-}
module Optparse (
Options(..),
parseOptions,
) where
import Options.Applicative
data Options = Options
{ optsFpath1 :: FilePath
, optsFpath2 :: Maybe FilePath
}
deriving (Show)
parseOptions :: IO Options
parseOptions = execParser $ info (pOptions <**> helper)
( fullDesc
<> progDesc "View, edit and diff binary files"
<> header "hhexed - haskell hex editor" )
pOptions :: Parser Options
pOptions = do
optsFpath1 <- strArgument
(metavar "FILE"
<> help "File to display")
optsFpath2 <- optional (strArgument
(metavar "FILE2"
<> help "File to diff against (optional)"))
return Options {..}
|