aboutsummaryrefslogtreecommitdiff
path: root/Commands.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2010-10-15 14:26:16 -0400
committerGravatar Joey Hess <joey@kitenet.net>2010-10-15 14:26:16 -0400
commitd7b170c9a2f9a7f52b6ef88243e249a04685764a (patch)
treeb943d40d664f147ea7ae2a280a10b21932aefb79 /Commands.hs
parente7ffa5b594deb9d89d555b24f8ed7842951905af (diff)
cleanup
Diffstat (limited to 'Commands.hs')
-rw-r--r--Commands.hs13
1 files changed, 7 insertions, 6 deletions
diff --git a/Commands.hs b/Commands.hs
index 5021ba260..aed3a19d3 100644
--- a/Commands.hs
+++ b/Commands.hs
@@ -25,16 +25,17 @@ import qualified Remotes
- actions to be run in the Annex monad. -}
parseCmd :: [String] -> IO ([Flag], [Annex ()])
parseCmd argv = do
- (flags, nonopts) <- getopt
- case (length nonopts) of
+ (flags, files) <- getopt
+ case (length files) of
0 -> error header
_ -> do
- let c = lookupCmd (nonopts !! 0)
+ let c = lookupCmd (files !! 0)
if (0 == length c)
- then return $ (flags, map defaultCmd nonopts)
- else do
- return $ (flags, map (snd $ c !! 0) $ drop 1 nonopts)
+ then ret flags defaultCmd files
+ else ret flags (snd $ c !! 0) $ drop 1 files
where
+ ret flags cmd files = return (flags, makeactions cmd files)
+ makeactions cmd files = map cmd files
getopt = case getOpt Permute options argv of
(flags, nonopts, []) -> return (flags, nonopts)
(_, _, errs) -> ioError (userError (concat errs ++ usageInfo header options))