diff options
| author | Joey Hess <joey@kitenet.net> | 2014-03-30 23:02:10 -0400 |
|---|---|---|
| committer | Joey Hess <joey@kitenet.net> | 2014-03-30 23:02:10 -0400 |
| commit | 02a7bf5f0e2de1d0dea71781ed0c1ae3a50e6425 (patch) | |
| tree | 7900cf0f30f2d27b9d79ae6fc561b79dc308feaa /CmdLine.hs | |
| parent | 647e1a6de21176625e1844c6b3838ffca8dca70e (diff) | |
tweak
Diffstat (limited to 'CmdLine.hs')
| -rw-r--r-- | CmdLine.hs | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -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 |
