aboutsummaryrefslogtreecommitdiff
path: root/tprint
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2016-03-01 07:42:49 +0100
committerGregor Kleen <gkleen@yggdrasil.li>2016-03-01 07:42:49 +0100
commitb302f3442a4884029f1839d4dbb25e82358ee758 (patch)
treeba4a087c51b3cff310eb070eced60720550058a5 /tprint
parent61c983bd242ec45726ce572e85c069ca9274c71e (diff)
downloadthermoprint-b302f3442a4884029f1839d4dbb25e82358ee758.tar
thermoprint-b302f3442a4884029f1839d4dbb25e82358ee758.tar.gz
thermoprint-b302f3442a4884029f1839d4dbb25e82358ee758.tar.bz2
thermoprint-b302f3442a4884029f1839d4dbb25e82358ee758.tar.xz
thermoprint-b302f3442a4884029f1839d4dbb25e82358ee758.zip
maintaining lists of supported formats
Diffstat (limited to 'tprint')
-rw-r--r--tprint/src/Options.hs7
1 files changed, 6 insertions, 1 deletions
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
6 , Operation(..) 6 , Operation(..)
7 , Input, Output 7 , Input, Output
8 , Format(..), Source(..), Sink(..) 8 , Format(..), Source(..), Sink(..)
9 , supportedInputs, supportedOutputs
9 , withArgs 10 , withArgs
10 , module Options.Utils 11 , module Options.Utils
11 ) where 12 ) where
@@ -75,6 +76,10 @@ data Source = Stdin | ReadFile FilePath
75data Sink = Stdout | WriteFile FilePath 76data Sink = Stdout | WriteFile FilePath
76 deriving (Show, Generic, PrettyVal) 77 deriving (Show, Generic, PrettyVal)
77 78
79supportedInputs, supportedOutputs :: [Format]
80supportedInputs = [BBCode]
81supportedOutputs = [Human]
82
78cmdPrinters :: ParserInfo Operation 83cmdPrinters :: ParserInfo Operation
79cmdPrinters = info cmdPrinters' $ mconcat [ header "List all available printers" 84cmdPrinters = info cmdPrinters' $ mconcat [ header "List all available printers"
80 ] 85 ]
@@ -104,7 +109,7 @@ pTPrint = TPrint <$> option (eitherReader parseBaseUrl) (metavar "URL" <> long "
104pOutput :: Parser Output 109pOutput :: Parser Output
105pOutput = (,) <$> pOutputFormat <*> pSink 110pOutput = (,) <$> pOutputFormat <*> pSink
106 where 111 where
107 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 112 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
108 pSink = option rSink $ metavar "PATH" <> long "output" <> short 'o' <> help "Send output to PATH (`-' means stdout)" <> value Stdout <> showDefault 113 pSink = option rSink $ metavar "PATH" <> long "output" <> short 'o' <> help "Send output to PATH (`-' means stdout)" <> value Stdout <> showDefault
109 rSink = rSink' <$> str 114 rSink = rSink' <$> str
110 where 115 where