diff options
| author | Joey Hess <joeyh@joeyh.name> | 2016-03-07 16:36:36 -0400 |
|---|---|---|
| committer | Joey Hess <joeyh@joeyh.name> | 2016-03-07 16:36:36 -0400 |
| commit | 16a95afa2fe22a4df9c371489c4ee7ffdef8e07b (patch) | |
| tree | 6e0869e78aba03be2591569369e1e099bb86568e /src/Propellor/CmdLine.hs | |
| parent | 9bbc292b3f903a1476e3524bb9198e58ce300401 (diff) | |
| parent | 822694e790102efa2a5bb4a0c3d62c6fce1d4e87 (diff) | |
Merge remote-tracking branch 'remotes/misandrist/FreeBSD' into wip
Diffstat (limited to 'src/Propellor/CmdLine.hs')
| -rw-r--r-- | src/Propellor/CmdLine.hs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/Propellor/CmdLine.hs b/src/Propellor/CmdLine.hs index 5dbc5836..1761a11e 100644 --- a/src/Propellor/CmdLine.hs +++ b/src/Propellor/CmdLine.hs @@ -21,7 +21,7 @@ import qualified Propellor.Property.Chroot as Chroot import qualified Propellor.Shim as Shim usage :: Handle -> IO () -usage h = hPutStrLn h $ unlines +usage h = hPutStrLn h $ unlines [ "Usage:" , " propellor" , " propellor hostname" @@ -47,10 +47,10 @@ usageError ps = do processCmdLine :: IO CmdLine processCmdLine = go =<< getArgs where - go ("--check":_) = return Check + go ("--check":_) = return Check go ("--spin":ps) = case reverse ps of - (r:"--via":hs) -> Spin - <$> mapM hostname (reverse hs) + (r:"--via":hs) -> Spin + <$> mapM hostname (reverse hs) <*> pure (Just r) _ -> Spin <$> mapM hostname ps <*> pure Nothing go ("--add-key":k:[]) = return $ AddKey k @@ -62,7 +62,7 @@ processCmdLine = go =<< getArgs go ("--edit":f:c:[]) = withprivfield f c Edit go ("--list-fields":[]) = return ListFields go ("--merge":[]) = return Merge - go ("--help":_) = do + go ("--help":_) = do usage stdout exitFailure go ("--boot":_:[]) = return $ Update Nothing -- for back-compat @@ -134,7 +134,7 @@ defaultMain hostlist = withConcurrentOutput $ do withhost :: HostName -> (Host -> IO ()) -> IO () withhost hn a = maybe (unknownhost hn hostlist) a (findHost hostlist hn) - + runhost hn = onlyprocess $ withhost hn mainProperties onlyprocess = onlyProcess (localdir </> ".lock") @@ -205,5 +205,5 @@ hostname s = go =<< catchDefaultIO [] dnslookup go (AddrInfo { addrCanonName = Just v } : _) = pure v go _ | "." `isInfixOf` s = pure s -- assume it's a fqdn - | otherwise = + | otherwise = error $ "cannot find host " ++ s ++ " in the DNS" |
