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(..) )
28 -- | The description of the program, displayed as part of the help.
32 "Monitor a list of Twitter accounts and display or email any new tweets."
35 -- | The name of this program.
37 program_name :: String
38 program_name = "halcyon"
41 -- | A summary string output as part of the help.
44 my_summary = program_name ++ "-" ++ (showVersion version)
47 -- | Help string for the \"consumer_key\" option.
49 consumer_key_help :: String
50 consumer_key_help = "Your Twitter API consumer key"
53 -- | Help string for the \"consumer_secret\" option.
55 consumer_secret_help :: String
56 consumer_secret_help = "Your Twitter API consumer secret"
59 -- | Help string for the \"access_token\" option
61 access_token_help :: String
62 access_token_help = "Your Twitter API access token"
65 -- | Help string for the \"access_secret\" option.
67 access_secret_help :: String
68 access_secret_help = "Your Twitter API access secret"
71 -- | Help string for the \"heartbeat\" option.
73 heartbeat_help :: String
74 heartbeat_help = "How many seconds to wait between polling"
77 -- | Help string for the \"to_address\" option.
79 to_address_help :: String
80 to_address_help = "Send tweets to ADDRESS"
83 -- | Help string for the \"from_address\" option.
85 from_address_help :: String
86 from_address_help = "Send tweets from ADDRESS"
89 -- | Help string for the \"sendmail_path\" option.
91 sendmail_path_help :: String
92 sendmail_path_help = "Use PATH to send mail"
95 -- | Help string for the \"ignore_replies\" option.
97 ignore_replies_help :: String
98 ignore_replies_help = "Ignore replies to other tweets"
101 -- | Help string for the \"ignore_retweets\" option.
103 ignore_retweets_help :: String
104 ignore_retweets_help = "Ignore retweets from other users"
107 -- | Help string for the \"verbose\" option.
109 verbose_help :: String
110 verbose_help = "Be verbose about stuff"
113 arg_spec :: OptionalCfg
118 &= groupname "Twitter API"
119 &= help consumer_key_help,
123 &= groupname "Twitter API"
124 &= help consumer_secret_help,
128 &= groupname "Twitter API"
129 &= help access_token_help,
133 &= groupname "Twitter API"
134 &= help access_secret_help,
137 def &= groupname "Miscellaneous"
138 &= help heartbeat_help,
141 def &= groupname "Miscellaneous"
142 &= help ignore_replies_help,
145 def &= groupname "Miscellaneous"
146 &= help ignore_retweets_help,
149 def &= groupname "Miscellaneous"
150 &= help verbose_help,
154 &= groupname "Mail Options"
155 &= help sendmail_path_help,
159 &= groupname "Mail Options"
160 &= help from_address_help,
164 &= groupname "Mail Options"
165 &= help to_address_help,
171 &= program program_name
172 &= summary my_summary
173 &= details [description]
174 &= helpArg [groupname "Common flags"]
175 &= versionArg [groupname "Common flags"]
177 show_help :: IO OptionalCfg
178 show_help = withArgs ["--help"] get_args
181 get_args :: IO OptionalCfg
182 get_args = cmdArgs arg_spec