Skip to content

Instantly share code, notes, and snippets.

@danidiaz
Created February 6, 2014 01:02
Show Gist options
  • Select an option

  • Save danidiaz/8836600 to your computer and use it in GitHub Desktop.

Select an option

Save danidiaz/8836600 to your computer and use it in GitHub Desktop.
optparse: some and many.
main :: IO ()
main = do
let files :: O.Parser [String]
files = O.helper <*> O.arguments1 (Just) (O.metavar "logfile" <> O.help "one or several log files")
foo = some $ O.strOption
( O.long "output"
<> O.short 'o'
<> O.metavar "FILENAME" )
parserInfo = O.info ((,) <$> files <*> foo) (O.fullDesc)
prefs = O.prefs O.showHelpOnError
foo <- O.customExecParser prefs parserInfo
putStrLn "--"
putStrLn $ show foo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment