[Option --max-items Manuel M T Chakravarty **20060508055245] { addfile ./test/polar/whereisthefish.lfi hunk ./Config.hs 34 +import Data.Char ( + isDigit) + hunk ./Config.hs 78 +-- * Strictly speaking we should use `Maybe Int' for `maxItems', but I doubt +-- that this will be an issue any time soon. +-- hunk ./Config.hs 82 - debugCfg :: Int, - feedDirCfg :: FilePath, - htmlDirCfg :: FilePath, - rssDirCfg :: FilePath, - verboseCfg :: Bool, - quietCfg :: Bool + debugCfg :: Int, + feedDirCfg :: FilePath, + htmlDirCfg :: FilePath, + maxItemsOpt :: Int, -- truncate any further channels items + rssDirCfg :: FilePath, + verboseCfg :: Bool, + quietCfg :: Bool hunk ./Config.hs 94 - debugCfg = 0, - feedDirCfg = ".", - htmlDirCfg = "", - rssDirCfg = "", - verboseCfg = False, - quietCfg = False + debugCfg = 0, + feedDirCfg = ".", + htmlDirCfg = "", + maxItemsOpt = maxBound, + rssDirCfg = "", + verboseCfg = False, + quietCfg = False hunk ./Config.hs 106 - | FeedDirOpt FilePath + | FeedDirOpt FilePath hunk ./Config.hs 108 - | HTMLDirOpt FilePath - | RSSDirOpt FilePath - | OutputOpt FilePath + | HTMLDirOpt FilePath + | MaxItemsOpt String + | RSSDirOpt FilePath + | OutputOpt FilePath hunk ./Config.hs 128 + , Option ['m'] ["max-items"] (ReqArg MaxItemsOpt "N") + "number of items after which to drop further items per channel" hunk ./Config.hs 195 + processOneOption config (MaxItemsOpt nStr) = + do + when (not . all isDigit $ nStr) $ + abort ["`" ++ nStr ++ "': not a number (--max-items)"] + return $ config {maxItemsOpt = read nStr} hunk ./LambdaFeed.hs 262 - return $ chan {itemsChan = sortBy newer (itemsChan chan)} + return $ chan {itemsChan = take (maxItemsOpt config) + . sortBy newer + $ itemsChan chan} hunk ./test/polar/morefish.lfi 5 - Yeah, we found more fish! Right in the whole in the ice at the south shore + Yeah, we found more fish! Right in the hole in the ice at the south shore hunk ./test/polar/morefish.lfi 8 + +PubDate: Mon, 08 May 2006 03:59:03 UTC + hunk ./test/polar/whereisthefish.lfi 1 +-- Another simple news item +-- +Title: Can't find any fish anymore! +Description: + Where is all the fish?? Couldn't find any in the hole! +Author: The Hungry Polar Bear + + +PubDate: Mon, 08 May 2006 05:27:32 UTC }