From a45cffb45e751275b30f558109c21d8c6507e07d Mon Sep 17 00:00:00 2001 From: Joris Date: Tue, 1 Sep 2015 15:18:57 +0200 Subject: Add a command line option to ignore materials --- src/CommandLineOptions.hs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'src/CommandLineOptions.hs') diff --git a/src/CommandLineOptions.hs b/src/CommandLineOptions.hs index bb0ac8d..9f8d849 100644 --- a/src/CommandLineOptions.hs +++ b/src/CommandLineOptions.hs @@ -1,15 +1,20 @@ +{-# LANGUAGE OverloadedStrings #-} + module CommandLineOptions - ( parseOptions + ( Options(..) + , parseOptions ) where +import Data.Text (Text) + data Options = Options - { materials :: [String] - , ignoreMaterials :: [String] - } + { materials :: [Text] + , ignoreMaterials :: [Text] + } deriving (Eq, Show) -parseOptions :: [String] -> Options +parseOptions :: [Text] -> Options parseOptions args = - case splitWhere (== "--ignore") args of + case splitWhere (== "--without") args of (materials, ignoredMaterials) -> Options materials ignoredMaterials splitWhere :: (a -> Bool) -> [a] -> ([a], [a]) -- cgit v1.2.3