From 02a7bf5f0e2de1d0dea71781ed0c1ae3a50e6425 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 30 Mar 2014 23:02:10 -0400 Subject: tweak --- CmdLine.hs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'CmdLine.hs') diff --git a/CmdLine.hs b/CmdLine.hs index a4ef3bae..c93d69ad 100644 --- a/CmdLine.hs +++ b/CmdLine.hs @@ -41,14 +41,20 @@ usage = do ] exitFailure -defaultMain :: (HostName -> [Property]) -> IO () +defaultMain :: (HostName -> Maybe [Property]) -> IO () defaultMain getprops = go =<< processCmdLine where - go (Run host) = ensureProperties (getprops host) + go (Run host) = maybe (unknownhost host) ensureProperties (getprops host) go (Spin host) = spin host - go (Boot host) = boot (getprops host) + go (Boot host) = maybe (unknownhost host) boot (getprops host) go (Set host field) = setPrivData host field +unknownhost :: HostName -> IO a +unknownhost h = error $ unwords + [ "Unknown host:", h + , "(perhaps you should specify the real hostname on the command line?)" + ] + spin :: HostName -> IO () spin host = do url <- getUrl -- cgit v1.3-2-g0d8e