packages feed

wordchoice 0.1.0.2 → 0.1.0.3

raw patch · 4 files changed

+8/−9 lines, 4 files

Files

src/Data/Text/WordCount.hs view
@@ -8,6 +8,7 @@     , makeDistribution     -- * File processing with pandoc     , processFile+    , globFile     -- * Low level-ish     , buildFreq     ) where
src/Data/Text/WordCount/Exec.hs view
@@ -10,16 +10,16 @@ import Data.Text.WordCount.FileRead  -- | Program datatype to be parsed-data Program = Program { file :: FilePath +data Program = Program { file :: [FilePath]                        , num :: Maybe Int                         , output :: Maybe FilePath } -- TODO add option for separators  -- | Command line argument parser program :: Parser Program program = Program-    <$> (argument str+    <$> (many (argument str         (metavar "FILEPATH"-        <> help "File to analyze"))+        <> help "File to analyze")))     <*> (optional (read <$> strOption         (short 'n'         <> long "number"@@ -51,7 +51,7 @@ -- | Run parsed record pick :: Program -> IO () pick rec = let n = fromMaybe 25 (num rec) in do-    contents <- processFile (file rec)+    contents <- globFile (file rec)     TLIO.putStrLn . displayWords . topN n $ contents      case output rec of         (Just out) -> flip makeFile out . topN n $ contents
src/Data/Text/WordCount/FileRead.hs view
@@ -11,10 +11,8 @@ eitherError = either (error . show) id  -- | Process files given a filename glob-globFile :: String -> IO T.Text-globFile str = do-    files <- glob str-    fmap T.concat . sequence $ fmap processFile files+globFile :: [String] -> IO T.Text+globFile files = fmap T.concat . sequence $ fmap processFile files  -- | Process a file given a filename. Return text only, discarding superflouous material. processFile :: String -> IO T.Text
wordchoice.cabal view
@@ -1,5 +1,5 @@ name:                wordchoice-version:             0.1.0.2+version:             0.1.0.3 synopsis:            Get word counts and distributions description:         A command line tool to compute the word distribution from various types of document, converting to text with pandoc. homepage:            https://github.com/githubuser/wordchoice#readme