Commit a0aaa865 authored by Mike Ledger's avatar Mike Ledger

sgort opts

parent 230ea8c2
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
......@@ -14,9 +15,7 @@ import Data.Csv (HasHeader (..))
import Data.List (isSuffixOf)
import qualified Data.Map.Strict as Map
import GHC.Generics (Generic)
import Options.Generic (type (<?>), ParseField,
ParseRecord, getRecord,
unHelpful)
import Options.Generic
import Streaming
import qualified Streaming.Csv as Csv
import qualified Streaming.Prelude as S
......@@ -37,14 +36,22 @@ data Options = Options
, hasHeader :: Maybe Bool <?> "whether to ignore header in csv files"
, op :: Maybe MapOp <?> "the operation to use to combine csv files \
\(default: union)"
} deriving (Show, Generic, ParseRecord)
} deriving (Show, Generic)
instance ParseRecord Options where
parseRecord = parseRecordWithModifiers lispCaseModifiers
{ shortNameModifier = \x -> case x of
"infiles" -> Just 'i'
"outfile" -> Just 'o'
_ -> Nothing
}
data Row
= EmptyRow
| Row !ByteString ![ByteString]
toRow :: [ByteString] -> Either () (ByteString, [ByteString])
toRow (h:hs) = Right (h, hs)
toRow (h:hs) = Right (h, hs)
toRow _ = Left ()
-- | select how to decode csv
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment