diff options
author | Joey Hess <joey@kitenet.net> | 2011-10-29 15:19:05 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-10-29 15:19:05 -0400 |
commit | f97c783283847c6cc4516673fe638b4d551e671d (patch) | |
tree | 3d9e96c4803f3310d82683f00c876f1d80c7be8e /CmdLine.hs | |
parent | 0d92aca1aabbbeb2d50d91807312ff6039971751 (diff) |
clean up check selection code
This new approach allows filtering out checks from the default set that are
not appropriate for a command, rather than having to list every check
that is appropriate. It also reduces some boilerplate.
Haskell does not define Eq for functions, so I had to go a long way around
with each check having a unique id. Meh.
Diffstat (limited to 'CmdLine.hs')
-rw-r--r-- | CmdLine.hs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/CmdLine.hs b/CmdLine.hs index 1037401e0..9f1ded498 100644 --- a/CmdLine.hs +++ b/CmdLine.hs @@ -38,10 +38,10 @@ parseCmd argv header cmds options = do when (null params) $ error $ "missing command" ++ usagemsg case lookupCmd (head params) of [] -> error $ "unknown command" ++ usagemsg - [command] -> do + [cmd] -> do _ <- sequence flags - checkCommand command - prepCommand command (drop 1 params) + checkCommand cmd + prepCommand cmd (drop 1 params) _ -> error "internal error: multiple matching commands" where getopt = case getOpt Permute options argv of |