]> gitweb.michael.orlitzky.com - dead/halcyon.git/commitdiff
Add (unimplemented) options to ignore retweets and replies.
authorMichael Orlitzky <michael@orlitzky.com>
Sun, 8 Apr 2012 02:02:08 +0000 (22:02 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Sun, 8 Apr 2012 02:02:08 +0000 (22:02 -0400)
src/CommandLine.hs

index 8d8ceab521037a38dca6e7f19b9c505b0884d61e..15120439d40dd1ece0a933bc730b4cafa2e906ff 100644 (file)
@@ -20,6 +20,8 @@ import System.Environment (getArgs)
 -- |A record containing values for all available options.
 data Options = Options { opt_heartbeat :: Maybe Int,
                          opt_help  :: Bool,
+                         opt_ignore_retweets :: Bool,
+                         opt_ignore_replies :: Bool,
                          opt_from :: Maybe String,
                          opt_to :: Maybe String }
 
@@ -29,6 +31,8 @@ data Options = Options { opt_heartbeat :: Maybe Int,
 default_options :: Options
 default_options = Options { opt_heartbeat = Just 600,
                             opt_help = False,
+                            opt_ignore_retweets = False,
+                            opt_ignore_replies = False,
                             opt_from = Nothing,
                             opt_to = Nothing }
 
@@ -43,10 +47,35 @@ default_options = Options { opt_heartbeat = Just 600,
 --
 options :: [OptDescr (Options -> IO Options)]
 options =
-  [ Option ['h'][] (NoArg set_help) "Prints this help message.",
-    Option ['n'][] (ReqArg set_heartbeat "heartbeat") "How many seconds to wait between polling.",
-    Option ['t'][] (ReqArg set_to "email_address") "Send tweets TO email_address.",
-    Option ['f'][] (ReqArg set_from "email_address") "Send tweets FROM email_address."
+  [ Option
+      ['h']["help"]
+      (NoArg set_help)
+      "Prints this help message.",
+           
+    Option
+      ['n']["heartbeat"]
+      (ReqArg set_heartbeat "heartbeat")
+      "How many seconds to wait between polling.",
+    
+    Option
+      ['t']["to"]
+      (ReqArg set_to "email_address")
+      "Send tweets TO email_address.",
+
+    Option
+      ['f']["from"]
+      (ReqArg set_from "email_address")
+      "Send tweets FROM email_address.",
+
+    Option
+      ['i']["ignore-retweets"]
+      (NoArg set_ignore_retweets)
+      "Ignore retweets.",
+
+    Option
+      ['I']["ignore-replies"]
+      (NoArg set_ignore_replies)
+      "Ignore retweets."
   ]
 
 
@@ -67,6 +96,14 @@ set_help :: Options -> IO Options
 set_help opts = do
   return opts { opt_help = True }
 
+set_ignore_retweets :: Options -> IO Options
+set_ignore_retweets opts =
+  return opts { opt_ignore_retweets = True }
+
+set_ignore_replies :: Options -> IO Options
+set_ignore_replies opts =
+  return opts { opt_ignore_replies = True }
+
 set_to :: String -> Options -> IO Options
 set_to arg opts = do
   return opts { opt_to = Just arg }