1{-# LANGUAGE OverloadedStrings #-}
2{-# LANGUAGE TypeApplications #-}
14import Data.Text (Text)
15import qualified Data.Text as T
16import Data.Version (showVersion)
17import Options.Applicative
18import Paths_xsd_isogen (version)
22data GenType = Parser | Generator | ParserAndGenerator
23 deriving (Read, Show, Eq, Bounded, Enum)
25genTypeToText :: GenType -> Text
26genTypeToText Parser = "Parser"
27genTypeToText Generator = "Generator"
28genTypeToText ParserAndGenerator = "ParserAndGenerator"
34 { oHeader :: Maybe Header
37 , oModule :: ModuleName
41optionsParser :: Parser Options
42optionsParser = Options
45 <> help "Do not place a header at the top of the file."
46 ) <|> Just <$> strOption
48 <> help "A custom header to be placed at the top of the file."
49 <> value ("This file was generated by xsd-isogen version "
50 <> T.pack (showVersion version)
51 <> "\nhttps://github.com/dredozubov/xsd-isogen")
57 <> value ParserAndGenerator
58 <> help ("Whether to generate both parsers and generators. One of: "
59 <> (mconcat . intersperse ", " . fmap show
60 $ [minBound @GenType .. maxBound]) <> ".")
65 <> help "Path to the input .xsd file."
70 <> help "Specify the name of the generated module."
75getOptions :: IO Options
76getOptions = execParser $ info (optionsParser <**> helper)
79 ( "xsd-isogen version " <> showVersion version
80 <> " (https://github.com/dredozubov/xsd-isogen)"
82 <> progDesc ( "A tool for generating xml-isogen-compatible "
83 <> "(https://github.com/typeable/xml-isogen) .hs files from .xsd files."
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list