summaryrefslogtreecommitdiff
path: root/CmdLine.hs
diff options
context:
space:
mode:
Diffstat (limited to 'CmdLine.hs')
-rw-r--r--CmdLine.hs12
1 files changed, 9 insertions, 3 deletions
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