Korjaa kirjoitusvirhe 'receive' komennossa

This commit is contained in:
Saku Laesvuori 2023-12-17 21:44:19 +02:00
parent 3be7c4a778
commit 8432e0dfb2
Signed by: slaesvuo
GPG Key ID: 257D284A2A1D3A32

View File

@ -59,15 +59,15 @@ printStateMain socket = do
printState acid
data Config = Config { socketPath :: FilePath, mail :: Mailbox, sendmailCommand :: String, runMode :: RunMode } deriving Show
data RunMode = Server { repoPath :: FilePath, portNumber :: Int } | Recieve | Print deriving Show
data RunMode = Server { repoPath :: FilePath, portNumber :: Int } | Receive | Print deriving Show
config :: Maybe Mailbox -> Parser Config
config mail = Config
<$> strOption (long "socket" <> short 's' <> metavar "FILE" <> value "/run/tiedote.md/acid.socket" <> showDefault <> help "Path for database socket")
<*> option readMailbox (long "address" <> short 'a' <> metavar "EMAIL" <> maybe mempty value mail <> help "Email address to send and recieve mail")
<*> option readMailbox (long "address" <> short 'a' <> metavar "EMAIL" <> maybe mempty value mail <> help "Email address to send and receive mail")
<*> strOption (long "sendmail" <> short 'm' <> metavar "FILE" <> value "sendmail" <> help "Sendmail command")
<*> hsubparser (command "server" (info serverCommand (progDesc "Run the server"))
<> command "recieve" (info (pure Recieve) (progDesc "Recieve an email"))
<> command "receive" (info (pure Receive) (progDesc "Receive an email"))
<> command "state" (info (pure Print) (progDesc "Print the server's current state")))
serverCommand :: Parser RunMode
@ -88,6 +88,6 @@ main = do
sendmailPath <- maybe (throwIO $ FileNotFoundError $ sendmailCommand args) pure =<<
findExecutable (sendmailCommand args)
case args of
Config {runMode = Recieve, ..} -> clientMain (SockAddrUnix socketPath) mail sendmailPath
Config {runMode = Receive, ..} -> clientMain (SockAddrUnix socketPath) mail sendmailPath
Config {runMode = Print, ..} -> printStateMain (SockAddrUnix socketPath)
Config {runMode = Server {..}, ..} -> serverMain (SockAddrUnix socketPath) mail repoPath sendmailPath portNumber