tweet-hs 1.0.1.8 → 1.0.1.9
raw patch · 5 files changed
+19/−7 lines, 5 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Web.Tweet: showNoReplies :: String -> Int -> Bool -> FilePath -> IO String
+ Web.Tweet: filterQuotes :: Timeline -> Timeline
+ Web.Tweet: filterRTs :: Timeline -> Timeline
+ Web.Tweet: filterReplies :: Timeline -> Timeline
+ Web.Tweet: showFilteredTL :: [Filter] -> String -> Int -> Bool -> FilePath -> IO String
+ Web.Tweet: type Filter = Timeline -> Timeline
+ Web.Tweet.Exec: [withRetweets] :: Command -> Bool
- Web.Tweet.Exec: Profile :: Maybe Int -> Maybe String -> Bool -> Command
+ Web.Tweet.Exec: Profile :: Maybe Int -> Maybe String -> Bool -> Bool -> Command
Files
- src/Web/Tweet.hs +4/−0
- src/Web/Tweet/API/Internal.hs +4/−3
- src/Web/Tweet/Exec.hs +9/−3
- src/Web/Tweet/Utils.hs +1/−0
- tweet-hs.cabal +1/−1
src/Web/Tweet.hs view
@@ -31,6 +31,10 @@ , credentialMem -- * Functions to generate a URL string from a `Tweet` , urlString+ -- * Timeline filters+ , filterReplies+ , filterRTs+ , filterQuotes -- * Helper function to print a bird , bird ) where
src/Web/Tweet/API/Internal.hs view
@@ -7,6 +7,8 @@ import Web.Tweet.Types import Web.Tweet.Utils +type Filter = Timeline -> Timeline+ -- | Show a user profile given screen name, how many tweets to return, -- and whether to print them in color. showProfile :: String -> Int -> Bool -> FilePath -> IO String@@ -24,9 +26,8 @@ showTimeline :: Int -> Bool -> FilePath -> IO String showTimeline count color = (fmap (showTweets color)) . getTimeline count --- | Display a user timeline, filtering out tweets-showNoReplies :: String -> Int -> Bool -> FilePath -> IO String-showNoReplies sn count color = (fmap (showTweets color . fmap filterReplies)) . getProfile sn count+showFilteredTL :: [Filter] -> String -> Int -> Bool -> FilePath -> IO String+showFilteredTL filters sn count color = (fmap (showTweets color . fmap (foldr (.) id filters))) . getProfile sn count -- | Display user timeline in color, as appropriate showTweets :: Bool -> Either (ParseError Char Void) Timeline -> String
src/Web/Tweet/Exec.hs view
@@ -19,7 +19,7 @@ -- TODO add boolean option to show ids alongside tweets data Command = Timeline { count :: Maybe Int } | SendInput { tweetInputs :: Maybe Int, replyId :: Maybe String, replyh :: Maybe [String] }- | Profile { count :: Maybe Int , screenName'' :: Maybe String, withReplies :: Bool }+ | Profile { count :: Maybe Int , screenName'' :: Maybe String, withReplies :: Bool, withRetweets :: Bool } | Mentions { count :: Maybe Int } | Markov { screenName' :: String } | Send { tweets :: Maybe Int , replyId :: Maybe String , replyh :: Maybe [String] , userInput :: String }@@ -80,8 +80,10 @@ selectCommand (SendInput maybeNum Nothing (Just h)) _ file = threadStdIn h Nothing (fromMaybe 15 maybeNum) file selectCommand (Timeline maybeNum) c file = putStrLn =<< showTimeline (fromMaybe 11 maybeNum) c file selectCommand (Mentions maybeNum) c file = putStrLn =<< showTweets c <$> mentions (fromMaybe 11 maybeNum) file-selectCommand (Profile maybeNum n False) c file = putStrLn =<< showProfile (fromMaybe mempty n) (fromMaybe 11 maybeNum) c file-selectCommand (Profile maybeNum n True) c file = putStrLn =<< showNoReplies (fromMaybe mempty n) (fromMaybe 11 maybeNum) c file+selectCommand (Profile maybeNum n False False) c file = putStrLn =<< showProfile (fromMaybe mempty n) (fromMaybe 11 maybeNum) c file+selectCommand (Profile maybeNum n True False) c file = putStrLn =<< showFilteredTL [filterReplies] (fromMaybe mempty n) (fromMaybe 11 maybeNum) c file+selectCommand (Profile maybeNum n False True) c file = putStrLn =<< showFilteredTL [filterRTs] (fromMaybe mempty n) (fromMaybe 11 maybeNum) c file+selectCommand (Profile maybeNum n True True) c file = putStrLn =<< showFilteredTL [filterReplies, filterRTs] (fromMaybe mempty n) (fromMaybe 11 maybeNum) c file selectCommand (Sort n maybeNum False) c file = putStrLn =<< showBest' n (fromMaybe 11 maybeNum) c file selectCommand (Sort n maybeNum True) c file = putStrLn =<< showBest n (fromMaybe 11 maybeNum) c file selectCommand (List maybeNum n) c file = putStrLn =<< showFavorites (fromMaybe 11 maybeNum) n c file@@ -255,6 +257,10 @@ long "no-replies" <> short 'r' <> help "Don't display replies.")+ <*> switch (+ long "no-retweets"+ <> short 't'+ <> help "Don't display retweets.") -- | Parser for the mention subcommand mentionsParser :: Parser Command
src/Web/Tweet/Utils.hs view
@@ -11,6 +11,7 @@ , getConfigData , filterQuotes , filterReplies+ , filterRTs ) where import Control.Composition
tweet-hs.cabal view
@@ -1,5 +1,5 @@ name: tweet-hs-version: 1.0.1.8+version: 1.0.1.9 synopsis: Command-line tool for twitter description: a Command Line Interface Tweeter homepage: https://github.com/vmchale/command-line-tweeter#readme