Skip to content

Commit

Permalink
Also print all the users who tweeted on this topic (inside the search…
Browse files Browse the repository at this point in the history
… window)
  • Loading branch information
Sam Stokes committed May 31, 2009
1 parent 3b5dd63 commit 0d02283
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions main.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module Main where
import Data.List
import System.Console.GetOpt
import System.Environment (getArgs)
import System.Exit (exitFailure)
Expand All @@ -9,13 +10,19 @@ import Twitter.Search
formatTweet :: Tweet -> String
formatTweet tweet = '@' : fromUser tweet ++ ": " ++ tweetText tweet

tweeters :: SearchResults -> [String]
tweeters = nub . sort . map fromUser . tweets

----- Handy command-line search client -----
usage = "Usage: twitsearch <OPTIONS> term [term ...]"

main = do
args <- getArgs
options <- parseArgs args
results <- search options
putStr "Tweeting about this: "
putStrLn $ intercalate ", " $ tweeters results
putStrLn $ take 80 $ repeat '-'
sequence $ map putStrLn $ map formatTweet $ tweets results

options :: [OptDescr Integer]
Expand Down

0 comments on commit 0d02283

Please sign in to comment.