summaryrefslogtreecommitdiff
path: root/Checks.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-12-29 14:28:19 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-12-29 14:28:19 -0400
commitee3407de64d52d91500c6b761ad45c7a22eb73cb (patch)
tree5740f4e2c706f033d1a18602eb7e9148f6a1f365 /Checks.hs
parent1b007068ca4936306889b8b3af2bf224746a2318 (diff)
block all commands that don't work in direct mode
I left status working in direct mode, although it doesn't show correct stats for known annex keys.
Diffstat (limited to 'Checks.hs')
-rw-r--r--Checks.hs6
1 files changed, 6 insertions, 0 deletions
diff --git a/Checks.hs b/Checks.hs
index 94ee75291..3757abb27 100644
--- a/Checks.hs
+++ b/Checks.hs
@@ -13,6 +13,7 @@ module Checks where
import Common.Annex
import Types.Command
import Init
+import Config
commonChecks :: [CommandCheck]
commonChecks = [repoExists]
@@ -20,6 +21,10 @@ commonChecks = [repoExists]
repoExists :: CommandCheck
repoExists = CommandCheck 0 ensureInitialized
+notDirect :: Command -> Command
+notDirect = addCheck $ whenM isDirect $
+ error "You cannot run this subcommand in a direct mode repository."
+
dontCheck :: CommandCheck -> Command -> Command
dontCheck check cmd = mutateCheck cmd $ \c -> filter (/= check) c
@@ -29,3 +34,4 @@ addCheck check cmd = mutateCheck cmd $ \c ->
mutateCheck :: Command -> ([CommandCheck] -> [CommandCheck]) -> Command
mutateCheck cmd@(Command { cmdcheck = c }) a = cmd { cmdcheck = a c }
+