From b302f3442a4884029f1839d4dbb25e82358ee758 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Tue, 1 Mar 2016 07:42:49 +0100 Subject: maintaining lists of supported formats --- tprint/src/Options.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tprint/src/Options.hs b/tprint/src/Options.hs index 96bbde6..e9dcfe6 100644 --- a/tprint/src/Options.hs +++ b/tprint/src/Options.hs @@ -6,6 +6,7 @@ module Options , Operation(..) , Input, Output , Format(..), Source(..), Sink(..) + , supportedInputs, supportedOutputs , withArgs , module Options.Utils ) where @@ -75,6 +76,10 @@ data Source = Stdin | ReadFile FilePath data Sink = Stdout | WriteFile FilePath deriving (Show, Generic, PrettyVal) +supportedInputs, supportedOutputs :: [Format] +supportedInputs = [BBCode] +supportedOutputs = [Human] + cmdPrinters :: ParserInfo Operation cmdPrinters = info cmdPrinters' $ mconcat [ header "List all available printers" ] @@ -104,7 +109,7 @@ pTPrint = TPrint <$> option (eitherReader parseBaseUrl) (metavar "URL" <> long " pOutput :: Parser Output pOutput = (,) <$> pOutputFormat <*> pSink where - pOutputFormat = option rCI $ metavar "FORMAT" <> long "output-format" <> short 'O' <> help ("Format to use for all output (possible values: " ++ show ([minBound..maxBound] :: [Format]) ++ ")") <> value Human <> showDefault + pOutputFormat = option rCI $ metavar "FORMAT" <> long "output-format" <> short 'O' <> help ("Format to use for all output (possible values: " ++ show supportedOutputs ++ ")") <> value (head supportedOutputs) <> showDefault pSink = option rSink $ metavar "PATH" <> long "output" <> short 'o' <> help "Send output to PATH (`-' means stdout)" <> value Stdout <> showDefault rSink = rSink' <$> str where -- cgit v1.2.3