6 import System.Console.CmdArgs (
19 import System.Environment (withArgs)
21 -- Get the version from Cabal.
22 import Paths_halcyon (version)
23 import Data.Version (showVersion)
25 import OptionalConfiguration ( OptionalCfg(..) )
29 "Monitor a list of Twitter accounts and display or email any new tweets."
31 program_name :: String
32 program_name = "halcyon"
35 my_summary = program_name ++ "-" ++ (showVersion version)
37 consumer_key_help :: String
38 consumer_key_help = "Your Twitter API consumer key"
40 consumer_secret_help :: String
41 consumer_secret_help = "Your Twitter API consumer secret"
43 access_token_help :: String
44 access_token_help = "Your Twitter API access token"
46 access_secret_help :: String
47 access_secret_help = "Your Twitter API access secret"
49 heartbeat_help :: String
50 heartbeat_help = "How many seconds to wait between polling"
52 to_address_help :: String
53 to_address_help = "Send tweets to ADDRESS"
55 from_address_help :: String
56 from_address_help = "Send tweets from ADDRESS"
58 sendmail_path_help :: String
59 sendmail_path_help = "Use PATH to send mail"
61 ignore_replies_help :: String
62 ignore_replies_help = "Ignore replies to other tweets"
64 ignore_retweets_help :: String
65 ignore_retweets_help = "Ignore retweets from other users"
67 verbose_help :: String
68 verbose_help = "Be verbose about stuff"
70 arg_spec :: OptionalCfg
75 &= groupname "Twitter API"
76 &= help consumer_key_help,
80 &= groupname "Twitter API"
81 &= help consumer_secret_help,
85 &= groupname "Twitter API"
86 &= help access_token_help,
90 &= groupname "Twitter API"
91 &= help access_secret_help,
94 def &= groupname "Miscellaneous"
95 &= help heartbeat_help,
98 def &= groupname "Miscellaneous"
99 &= help ignore_replies_help,
102 def &= groupname "Miscellaneous"
103 &= help ignore_retweets_help,
106 def &= groupname "Miscellaneous"
107 &= help verbose_help,
111 &= groupname "Mail Options"
112 &= help sendmail_path_help,
116 &= groupname "Mail Options"
117 &= help from_address_help,
121 &= groupname "Mail Options"
122 &= help to_address_help,
128 &= program program_name
129 &= summary my_summary
130 &= details [description]
131 &= helpArg [groupname "Common flags"]
132 &= versionArg [groupname "Common flags"]
134 show_help :: IO OptionalCfg
135 show_help = withArgs ["--help"] get_args
138 get_args :: IO OptionalCfg
139 get_args = cmdArgs arg_spec