Skip to content
Snippets Groups Projects
Commit 89b91aa6 authored by Alice Brenon's avatar Alice Brenon
Browse files

Take output options from EDdAClinic

parent f7b5f829
No related branches found
No related tags found
No related merge requests found
cabal-version: 2.4 cabal-version: 2.4
name: ghc-geode name: geode
version: 0.1.0.0 version: 0.1.0.0
synopsis: synopsis:
Data structures and tooling used in project GEODE Data structures and tooling used in project GEODE
...@@ -34,6 +34,7 @@ library ...@@ -34,6 +34,7 @@ library
, bytestring >= 0.11.3 && <0.12 , bytestring >= 0.11.3 && <0.12
, containers >= 0.6.5.1 && <0.7 , containers >= 0.6.5.1 && <0.7
, cassava >= 0.5.3 && <0.6 , cassava >= 0.5.3 && <0.6
, optparse-applicative >= 0.13.2 && < 0.18
, text >= 1.2.5 && <1.3 , text >= 1.2.5 && <1.3
, vector >= 0.12.3.1 && <0.13 , vector >= 0.12.3.1 && <0.13
hs-source-dirs: lib hs-source-dirs: lib
......
(use-modules ((gnu packages haskell-xyz) #:select (ghc-cassava)) (use-modules ((gnu packages haskell-xyz) #:select (ghc-cassava
ghc-optparse-applicative))
((guix build-system haskell) #:select (haskell-build-system)) ((guix build-system haskell) #:select (haskell-build-system))
((guix git-download) #:select (git-predicate)) ((guix git-download) #:select (git-predicate))
((guix gexp) #:select (local-file)) ((guix gexp) #:select (local-file))
...@@ -15,7 +16,7 @@ ...@@ -15,7 +16,7 @@
#:recursive? #t #:recursive? #t
#:select? (git-predicate %source-dir))) #:select? (git-predicate %source-dir)))
(build-system haskell-build-system) (build-system haskell-build-system)
(inputs (list ghc-cassava)) (inputs (list ghc-cassava ghc-optparse-applicative))
(home-page "https://gitlab.liris.cnrs.fr/geode/ghc-geode") (home-page "https://gitlab.liris.cnrs.fr/geode/ghc-geode")
(synopsis "Data structures and tooling used in project GEODE") (synopsis "Data structures and tooling used in project GEODE")
(description (description
......
module Options.GEODE
( Output(..)
, output ) where
import Control.Applicative (optional)
import Data.Maybe (catMaybes)
import Options.Applicative
( Parser, flag, help, long, metavar, short
, strOption )
data OutputFlags =
OutputFlags
{ metadata :: Maybe ()
, textRoot :: Maybe FilePath
, xmlRoot :: Maybe FilePath }
data Output = Metadata | TextRoot FilePath | XMLRoot FilePath
outputFlags :: Parser OutputFlags
outputFlags = OutputFlags
<$> flag Nothing (Just ())
( long "metadata"
<> short 'm'
<> help "Print metadata for splitted files on stdout" )
<*> (optional . strOption)
( long "text-root"
<> short 't'
<> metavar "DIRECTORY"
<> help "Path where to create files containing the text version of the articles" )
<*> (optional . strOption)
( long "xml-root"
<> short 'x'
<> metavar "DIRECTORY"
<> help "Path where to create files containing the XML" )
output :: Parser [Output]
output = catMaybes . toList <$> outputFlags
where
toList (OutputFlags {metadata, textRoot, xmlRoot}) =
[ Metadata <$ metadata, TextRoot <$> textRoot, XMLRoot <$> xmlRoot ]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment