diff options
author | Joey Hess <joey@kitenet.net> | 2012-12-29 14:28:19 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-12-29 14:28:19 -0400 |
commit | ee3407de64d52d91500c6b761ad45c7a22eb73cb (patch) | |
tree | 5740f4e2c706f033d1a18602eb7e9148f6a1f365 /Checks.hs | |
parent | 1b007068ca4936306889b8b3af2bf224746a2318 (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.hs | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -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 } + |