spreadsheet 0.1.3.6 → 0.1.3.7
raw patch · 6 files changed
+22/−12 lines, 6 files
Files
- example/CSVExtract.hs +1/−1
- example/CSVExtract/Option.hs +2/−4
- example/CSVReplace.hs +1/−1
- example/CSVReplace/Option.hs +2/−4
- example/Option.hs +14/−0
- spreadsheet.cabal +2/−2
example/CSVExtract.hs view
@@ -62,7 +62,7 @@ opt <- OP.execParser $ Option.info Option.parser let placeholders = ListHT.chop (','==) $ Option.columns opt let ignore = ListHT.chop (','==) $ Option.ignore opt- template <- readFile $ Option.template opt+ template <- Option.readTemplate opt interact $ \input -> Sheet.toString (Option.quotation opt) (Option.delimiter opt) $ (if Option.header opt then (placeholders:) else id) $
example/CSVExtract/Option.hs view
@@ -34,9 +34,7 @@ OP.help "Emit column headers") <*> Option.delimiter <*> Option.quotation- <*> (OP.strArgument $- OP.metavar "TEMPLATE" <>- OP.help "Template file")+ <*> Option.template data Option =@@ -44,5 +42,5 @@ columns, ignore :: String, header :: Bool, delimiter, quotation :: Char,- template :: FilePath+ readTemplate :: IO String }
example/CSVReplace.hs view
@@ -33,7 +33,7 @@ main :: IO () main = do opt <- OP.execParser $ Option.info Option.parser- template <- readFile $ Option.template opt+ template <- Option.readTemplate opt sheet <- Sheet.fromString (Option.quotation opt) (Option.delimiter opt) <$> getContents
example/CSVReplace/Option.hs view
@@ -27,14 +27,12 @@ OP.help "Generate one file per CSV row") <*> Option.delimiter <*> Option.quotation- <*> (OP.strArgument $- OP.metavar "TEMPLATE" <>- OP.help "Template file")+ <*> Option.template data Option = Option { multiFile :: Maybe FilePath, delimiter, quotation :: Char,- template :: FilePath+ readTemplate :: IO String }
example/Option.hs view
@@ -1,6 +1,7 @@ module Option where import qualified Options.Applicative as OP+import Control.Applicative ((<|>)) import Data.Monoid ((<>)) @@ -31,3 +32,16 @@ "\\t" -> Right '\t' _ -> Left $ name ++ " must be one character, which " ++ show str ++ " is not"++template :: OP.Parser (IO String)+template =+ (fmap readFile $+ OP.strArgument $+ OP.metavar "TEMPLATE" <>+ OP.help "Template file")+ <|>+ (fmap return $+ OP.strOption $+ OP.long "template" <>+ OP.metavar "TEXT" <>+ OP.help "Template text")
spreadsheet.cabal view
@@ -1,5 +1,5 @@ Name: spreadsheet-Version: 0.1.3.6+Version: 0.1.3.7 License: BSD3 License-File: LICENSE Author: Henning Thielemann <haskell@henning-thielemann.de>@@ -44,7 +44,7 @@ Location: http://code.haskell.org/~thielema/spreadsheet/ Source-Repository this- Tag: 0.1.3.6+ Tag: 0.1.3.7 Type: darcs Location: http://code.haskell.org/~thielema/spreadsheet/