summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-06-02 02:40:43 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-06-02 02:40:43 -0400
commitbcb72ce0f2623a77d18f8064738ba26661dad762 (patch)
tree89d9535c599ad9cd628116860139efc85ce0623d
parentf2cc87860ccb4ccb4a51dd9d255717a0e749fe76 (diff)
tweak
-rw-r--r--CmdLine.hs4
-rw-r--r--GitAnnex.hs4
-rw-r--r--git-annex-shell.hs7
3 files changed, 6 insertions, 9 deletions
diff --git a/CmdLine.hs b/CmdLine.hs
index 684ebf979..861a31be9 100644
--- a/CmdLine.hs
+++ b/CmdLine.hs
@@ -28,8 +28,8 @@ import Messages
import UUID
{- Runs the passed command line. -}
-dispatch :: Git.Repo -> [String] -> [Command] -> [Option] -> String -> IO ()
-dispatch gitrepo args cmds options header = do
+dispatch :: [String] -> [Command] -> [Option] -> String -> Git.Repo -> IO ()
+dispatch args cmds options header gitrepo = do
setupConsole
state <- Annex.new gitrepo allBackends
(actions, state') <- Annex.run state $ parseCmd args header cmds options
diff --git a/GitAnnex.hs b/GitAnnex.hs
index b22313d3c..103ee262f 100644
--- a/GitAnnex.hs
+++ b/GitAnnex.hs
@@ -113,6 +113,4 @@ header :: String
header = "Usage: git-annex command [option ..]"
run :: [String] -> IO ()
-run args = do
- gitrepo <- Git.repoFromCwd
- dispatch gitrepo args cmds options header
+run args = dispatch args cmds options header =<< Git.repoFromCwd
diff --git a/git-annex-shell.hs b/git-annex-shell.hs
index 940db71c3..55f34e102 100644
--- a/git-annex-shell.hs
+++ b/git-annex-shell.hs
@@ -58,10 +58,9 @@ builtins :: [String]
builtins = map cmdname cmds
builtin :: String -> String -> [String] -> IO ()
-builtin cmd dir params = do
- dir' <- Git.repoAbsPath dir
- gitrepo <- Git.repoFromAbsPath dir'
- dispatch gitrepo (cmd:(filterparams params)) cmds commonOptions header
+builtin cmd dir params =
+ Git.repoAbsPath dir >>= Git.repoFromAbsPath >>=
+ dispatch (cmd:(filterparams params)) cmds commonOptions header
external :: [String] -> IO ()
external params = do