diff options
author | Joey Hess <joey@kitenet.net> | 2010-11-11 17:58:55 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2010-11-11 17:58:55 -0400 |
commit | ce62f5abf16e578f9f4b86cd140ea2ddfb1e4217 (patch) | |
tree | d50e4c639c2eb5a16ff292827378608f4ee6d68d /Command.hs | |
parent | b5ce88dd2aa2d6cc5eac6fd014f94d387c38bce0 (diff) |
rework command dispatching for add and pre-commit
Both subcommands do two different operations on different sets of files, so
allowing a subcommand to perform a list of operations cleans things up.
Diffstat (limited to 'Command.hs')
-rw-r--r-- | Command.hs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Command.hs b/Command.hs index f896a53f6..90c4d5385 100644 --- a/Command.hs +++ b/Command.hs @@ -41,7 +41,7 @@ type SubCmdSeekNothing = SubCmdStart -> SubCmdSeek data SubCommand = SubCommand { subcmdname :: String, subcmdparams :: String, - subcmdseek :: SubCmdSeek, + subcmdseek :: [SubCmdSeek], subcmddesc :: String } @@ -49,8 +49,8 @@ data SubCommand = SubCommand { - the parameters passed to it. -} prepSubCmd :: SubCommand -> AnnexState -> [String] -> IO [Annex Bool] prepSubCmd SubCommand { subcmdseek = seek } state params = do - list <- Annex.eval state $ seek params - return $ map doSubCmd list + lists <- Annex.eval state $ mapM (\s -> s params) seek + return $ map doSubCmd $ foldl (++) [] lists {- Runs a subcommand through the start, perform and cleanup stages -} doSubCmd :: SubCmdStart -> SubCmdCleanup |