tweet-hs 0.6.1.2 → 0.6.1.3
raw patch · 4 files changed
+21/−3 lines, 4 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
+ Web.Tweet: showBest' :: String -> Int -> Bool -> FilePath -> IO String
+ Web.Tweet.Exec: [includeReplies] :: Command -> Bool
- Web.Tweet.Exec: Sort :: String -> Maybe Int -> Command
+ Web.Tweet.Exec: Sort :: String -> Maybe Int -> Bool -> Command
Files
- src/Web/Tweet/API.hs +4/−0
- src/Web/Tweet/Exec.hs +7/−2
- src/Web/Tweet/Utils.hs +9/−0
- tweet-hs.cabal +1/−1
src/Web/Tweet/API.hs view
@@ -70,6 +70,10 @@ showBest :: String -> Int -> Bool -> FilePath -> IO String showBest screenName n color = fmap (showTweets color . pure . (take n . hits)) . getAll screenName Nothing +-- | Show the most successful tweets by a given user, given their screen name. Additionally filter out replies.+showBest' :: String -> Int -> Bool -> FilePath -> IO String+showBest' screenName n color = fmap (showTweets color . pure . (take n . hits')) . getAll screenName Nothing+ -- | Mute a user given their screen name mute :: String -> FilePath -> IO () mute = (fmap void) . muteUserRaw
src/Web/Tweet/Exec.hs view
@@ -23,7 +23,7 @@ | Mentions { count :: Maybe Int } | Markov { screenName :: String } | Send { tweets :: Maybe Int , replyId :: Maybe String , replyHandles :: Maybe [String] , userInput :: String }- | Sort { screenName :: String , count :: Maybe Int }+ | Sort { screenName :: String , count :: Maybe Int , includeReplies :: Bool } | Delete { twId :: Integer } | Fav { twId :: Integer } | Unfav { twId :: Integer }@@ -79,7 +79,8 @@ selectCommand (Timeline maybeNum) color file = putStrLn =<< showTimeline (fromMaybe 11 maybeNum) color file selectCommand (Mentions maybeNum) color file = putStrLn =<< showTweets color <$> mentions (fromMaybe 11 maybeNum) file selectCommand (Profile maybeNum name) color file = putStrLn =<< showProfile (fromMaybe mempty name) (fromMaybe 11 maybeNum) color file-selectCommand (Sort name maybeNum) color file = putStrLn =<< showBest name (fromMaybe 11 maybeNum) color file+selectCommand (Sort name maybeNum False) color file = putStrLn =<< showBest' name (fromMaybe 11 maybeNum) color file+selectCommand (Sort name maybeNum True) color file = putStrLn =<< showBest name (fromMaybe 11 maybeNum) color file selectCommand (Markov name) _ file = do raw <- getMarkov name Nothing file appendFile (name ++ ".txt") (unlines raw)@@ -246,6 +247,10 @@ <> short 'n' <> metavar "NUM" <> help "Number of tweetInputs to fetch, default 12"))+ <*> switch+ (long "replies"+ <> short 'r'+ <> help "Include replies in your all-time hits") -- | Parser for the send subcommand tweet :: Parser Command
src/Web/Tweet/Utils.hs view
@@ -1,6 +1,7 @@ -- | Miscellaneous functions that don't fit the project directly module Web.Tweet.Utils ( hits+ , hits' , getTweetsFast , getTweets , displayTimeline@@ -24,9 +25,17 @@ hits :: Timeline -> Timeline hits = sortTweets . filterRTs +-- | Filter out retweets and replies, and sort by most sucessful.+hits' :: Timeline -> Timeline+hits' = hits . filterReplies+ -- | Filter out retweets filterRTs :: Timeline -> Timeline filterRTs = filter ((/="RT @") . take 4 . (view text))++-- | Filter out replies+filterReplies :: Timeline -> Timeline+filterReplies = filter ((/="@") . take 1 . (view text)) -- | Filter out quotes filterQuotes :: Timeline -> Timeline
tweet-hs.cabal view
@@ -1,5 +1,5 @@ name: tweet-hs-version: 0.6.1.2+version: 0.6.1.3 synopsis: Command-line tool for twitter description: a Command Line Interface Tweeter homepage: https://github.com/vmchale/command-line-tweeter#readme