X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=src%2FCommandLine.hs;h=660458b0da425b0f5b5de7f0f3dca0f55ff8976d;hb=HEAD;hp=cfb43b387b7d30a21ca105ca71a0daa22e1bba8a;hpb=5124833f973f6c47a4eda3f4e343d3d8631897c6;p=dead%2Fhtsn-import.git diff --git a/src/CommandLine.hs b/src/CommandLine.hs index cfb43b3..660458b 100644 --- a/src/CommandLine.hs +++ b/src/CommandLine.hs @@ -1,9 +1,11 @@ -- | Parse the command-line options, and display help text if -- necessary. +-- module CommandLine ( get_args ) where +-- System imports. import System.Console.CmdArgs ( (&=), args, @@ -15,50 +17,58 @@ import System.Console.CmdArgs ( summary, typ, typFile ) +import Paths_htsn_import ( version ) -- These let us get the +import Data.Version ( showVersion ) -- version from Cabal. --- This let's us get the version from Cabal. -import Paths_htsn_import (version) -import Data.Version (showVersion) - +-- Local imports. import OptionalConfiguration ( OptionalConfiguration(..) ) + -- | The description of the program, displayed as part of the help. description :: String description = "Import XML files from The Sports Network into an RDBMS." + -- | The name of this program. program_name :: String program_name = "htsn-import" + -- | A summary string output as part of the help. my_summary :: String my_summary = program_name ++ "-" ++ (showVersion version) + -- | A description of the "backend" option. backend_help :: String backend_help = "Database choice, either \"Sqlite\" or \"Postgres\"." + -- | A description of the "connection_string" option. connection_string_help :: String connection_string_help = "A database-specific connection string (depends on the backend)." + -- | A description of the "log_file" option. log_file_help :: String log_file_help = "Log to the given file." + -- | A description of the "log_level" option. log_level_help :: String log_level_help = "How verbose should the logs be? One of INFO, WARNING, ERROR." + -- | A description of the "remove" option. remove_help :: String remove_help = "Remove files that have been successfully imported." + -- | A description of the "syslog" option. syslog_help :: String syslog_help = @@ -68,6 +78,7 @@ syslog_help = -- | A data structure representing the possible command-line -- options. The CmdArgs library is doing heavy magic beneath the -- hood here. +-- arg_spec :: OptionalConfiguration arg_spec = OptionalConfiguration { @@ -85,5 +96,6 @@ arg_spec = -- | A convenience function; our only export. Meant to be used in -- 'main' to retrieve the command-line arguments. +-- get_args :: IO OptionalConfiguration get_args = cmdArgs arg_spec