Minor refactoring.

master
Abhinav Sarkar 7 years ago
parent 7cec652d96
commit 57e76321a1
No known key found for this signature in database
GPG Key ID: 7C9166A6F5465AD5
  1. 33
      ringo-app/src/Ringo/ArgParser.hs

@ -21,19 +21,22 @@ data ProgArgs = ProgArgs
, progOutputDir :: FilePath
} deriving (Eq, Show)
textOption :: Mod OptionFields String -> Parser Text.Text
textOption o = Text.pack <$> strOption o
settingsParser :: Parser Settings
settingsParser = let Settings {..} = defSettings
in Settings
<$> (Text.pack <$> strOption (long "dim-prefix"
<> short 'd'
<> value (Text.unpack settingDimPrefix)
<> showDefault
<> help "Prefix for dimension tables"))
<*> (Text.pack <$> strOption (long "fact-prefix"
<> short 'f'
<> value (Text.unpack settingFactPrefix)
<> showDefault
<> help "Prefix for fact tables"))
<$> textOption (long "dim-prefix"
<> short 'd'
<> value (Text.unpack settingDimPrefix)
<> showDefault
<> help "Prefix for dimension tables")
<*> textOption (long "fact-prefix"
<> short 'f'
<> value (Text.unpack settingFactPrefix)
<> showDefault
<> help "Prefix for fact tables")
<*> minorOption "fact-infix"
settingFactInfix
"Infix for fact tables"
@ -84,11 +87,11 @@ settingsParser = let Settings {..} = defSettings
"Suffix template for table names in SQL"
where
minorOption longDesc defValue helpTxt =
Text.pack <$> strOption (long longDesc
<> hidden
<> value (Text.unpack defValue)
<> showDefault
<> help helpTxt)
textOption (long longDesc
<> hidden
<> value (Text.unpack defValue)
<> showDefault
<> help helpTxt)
progArgsParser :: Parser ProgArgs
progArgsParser =

Loading…
Cancel
Save