summaryrefslogtreecommitdiff
path: root/CmdLine.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-10-27 16:31:35 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-10-27 16:31:35 -0400
commit5b74b130a39d8c45e7d24520d838d6c1635582c7 (patch)
tree3d2816f028e7135a168d64c6342e1a2588260417 /CmdLine.hs
parent66194684acaf8dc5c72e5a163465b42050cf9212 (diff)
refactored and generalized pre-command sanity checking
Diffstat (limited to 'CmdLine.hs')
-rw-r--r--CmdLine.hs7
1 files changed, 1 insertions, 6 deletions
diff --git a/CmdLine.hs b/CmdLine.hs
index b1c9c1728..1037401e0 100644
--- a/CmdLine.hs
+++ b/CmdLine.hs
@@ -21,7 +21,6 @@ import qualified Git
import Annex.Content
import Command
import Options
-import Init
{- Runs the passed command line. -}
dispatch :: [String] -> [Command] -> [Option] -> String -> Git.Repo -> IO ()
@@ -41,7 +40,7 @@ parseCmd argv header cmds options = do
[] -> error $ "unknown command" ++ usagemsg
[command] -> do
_ <- sequence flags
- checkCmdEnviron command
+ checkCommand command
prepCommand command (drop 1 params)
_ -> error "internal error: multiple matching commands"
where
@@ -53,10 +52,6 @@ parseCmd argv header cmds options = do
lookupCmd cmd = filter (\c -> cmd == cmdname c) cmds
usagemsg = "\n\n" ++ usage header cmds options
-{- Checks that the command can be run in the current environment. -}
-checkCmdEnviron :: Command -> Annex ()
-checkCmdEnviron command = when (cmdusesrepo command) ensureInitialized
-
{- Usage message with lists of commands and options. -}
usage :: String -> [Command] -> [Option] -> String
usage header cmds options =