6 import System.Console.CmdArgs (
20 import System.Environment ( withArgs )
22 -- Get the version from Cabal.
23 import Paths_halcyon ( version )
24 import Data.Version ( showVersion )
26 import OptionalConfiguration ( OptionalCfg(..) )
29 -- | The description of the program, displayed as part of the help.
33 "Monitor a list of Twitter accounts and display or email any new tweets."
36 -- | The name of this program.
38 program_name :: String
39 program_name = "halcyon"
42 -- | A summary string output as part of the help.
45 my_summary = program_name ++ "-" ++ (showVersion version)
48 -- | Help string for the \"access_secret\" option.
50 access_secret_help :: String
51 access_secret_help = "Your Twitter API access secret"
54 -- | Help string for the \"access_token\" option
56 access_token_help :: String
57 access_token_help = "Your Twitter API access token"
60 -- | Help string for the \"consumer_key\" option.
62 consumer_key_help :: String
63 consumer_key_help = "Your Twitter API consumer key"
66 -- | Help string for the \"consumer_secret\" option.
68 consumer_secret_help :: String
69 consumer_secret_help = "Your Twitter API consumer secret"
72 -- | A description of the \"daemonize\" option.
74 daemonize_help :: String
75 daemonize_help = "Run as a daemon, in the background."
78 -- | Help string for the \"from_address\" option.
80 from_address_help :: String
81 from_address_help = "Send tweets from ADDRESS"
84 -- | Help string for the \"heartbeat\" option.
86 heartbeat_help :: String
87 heartbeat_help = "How many seconds to wait between polling"
90 -- | Help string for the \"ignore_replies\" option.
92 ignore_replies_help :: String
93 ignore_replies_help = "Ignore replies to other tweets"
96 -- | Help string for the \"ignore_retweets\" option.
98 ignore_retweets_help :: String
99 ignore_retweets_help = "Ignore retweets from other users"
102 -- | A description of the "pidfile" option.
103 pidfile_help :: String
105 "Location to create PID file (daemon only)."
108 -- | A description of the "run_as_group" option.
109 run_as_group_help :: String
111 "System group to run as (daemon only)."
114 -- | A description of the "run_as_user" option.
115 run_as_user_help :: String
117 "System user to run under (daemon only)."
120 -- | Help string for the \"to_address\" option.
122 to_address_help :: String
123 to_address_help = "Send tweets to ADDRESS"
127 -- | Help string for the \"sendmail_path\" option.
129 sendmail_path_help :: String
130 sendmail_path_help = "Use PATH to send mail"
133 -- | Help string for the \"verbose\" option.
135 verbose_help :: String
136 verbose_help = "Be verbose about stuff"
139 arg_spec :: OptionalCfg
145 &= groupname "Twitter API"
146 &= help access_secret_help,
150 &= groupname "Twitter API"
151 &= help access_token_help,
155 &= groupname "Twitter API"
156 &= help consumer_key_help,
160 &= groupname "Twitter API"
161 &= help consumer_secret_help,
165 def &= groupname "Miscellaneous"
166 &= help daemonize_help,
170 &= groupname "Mail Options"
171 &= help from_address_help,
174 def &= groupname "Miscellaneous"
175 &= help heartbeat_help,
178 def &= groupname "Miscellaneous"
179 &= help ignore_replies_help,
182 def &= groupname "Miscellaneous"
183 &= help ignore_retweets_help,
187 &= help pidfile_help,
191 &= help run_as_group_help,
195 &= help run_as_user_help,
199 &= groupname "Mail Options"
200 &= help sendmail_path_help,
204 &= groupname "Mail Options"
205 &= help to_address_help,
212 def &= groupname "Miscellaneous"
213 &= help verbose_help }
215 &= program program_name
216 &= summary my_summary
217 &= details [description]
218 &= helpArg [groupname "Common flags"]
219 &= versionArg [groupname "Common flags"]
222 show_help :: IO OptionalCfg
223 show_help = withArgs ["--help"] get_args
226 get_args :: IO OptionalCfg
227 get_args = cmdArgs arg_spec