From a5c32cfae40a9b90e6727d6fae215c2dee437cd5 Mon Sep 17 00:00:00 2001
From: Alice BRENON <alice.brenon@ens-lyon.fr>
Date: Wed, 12 Jul 2023 22:25:10 +0200
Subject: [PATCH] Expose the xmlOutput parser separately

---
 lib/GEODE/Options.hs | 27 ++++++++++++++++-----------
 1 file changed, 16 insertions(+), 11 deletions(-)

diff --git a/lib/GEODE/Options.hs b/lib/GEODE/Options.hs
index 38f0b78..66d7949 100644
--- a/lib/GEODE/Options.hs
+++ b/lib/GEODE/Options.hs
@@ -5,7 +5,8 @@ module GEODE.Options
   , Output(..)
   , input
   , ioConfig
-  , output ) where
+  , output
+  , xmlOutput ) where
 
 import Control.Applicative ((<|>))
 import Data.List.NonEmpty (NonEmpty(..))
@@ -21,24 +22,28 @@ input stdinSemantics =
   argument
     (File <$> str)
     ( value StdIn
-      <> metavar "INPUT_FILE"
-      <> help (printf "path of the file to process (%s)" stdinSemantics) )
+    <> metavar "INPUT_FILE"
+    <> help (printf "path of the file to process (%s)" stdinSemantics) )
 
 data Output = Metadata | TextRoot FilePath | XMLRoot FilePath
 
+xmlOutput :: Parser FilePath
+xmlOutput =
+  strOption
+    ( long "xml-root" <> metavar "DIRECTORY" <> short 'x'
+    <> help "Root path where to output XML files" )
+
 output :: Parser Output
 output =
     flag' Metadata ( long "metadata"
-                     <> short 'm'
-                     <> help "Print metadata for splitted files on stdout" )
+                   <> short 'm'
+                   <> help "Print metadata for splitted files on stdout" )
   <|> (TextRoot <$> strOption
         ( long "text-root"
-          <> short 't'
-          <> help "Root path where to output text files" ))
-  <|> (XMLRoot <$> strOption
-        ( long "xml-root"
-          <> short 'x'
-          <> help "Root path where to output XML files" ))
+        <> metavar "DIRECTORY"
+        <> short 't'
+        <> help "Root path where to output text files" ))
+  <|> (XMLRoot <$> xmlOutput)
 
 data IOConfig = IOConfig
   { from :: Input
-- 
GitLab