Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: 48dd2ff264
Fetching contributors…

Cannot retrieve contributors at this time

32 lines (24 sloc) 0.838 kB
{- git-annex command checks
-
- Common sanity checks for commands, and an interface to selectively
- remove them, or add others.
-
- Copyright 2011 Joey Hess <joey@kitenet.net>
-
- Licensed under the GNU GPL version 3 or higher.
-}
module Checks where
import Common.Annex
import Types.Command
import Init
commonChecks :: [CommandCheck]
commonChecks = [repoExists]
repoExists :: CommandCheck
repoExists = CommandCheck 0 ensureInitialized
dontCheck :: CommandCheck -> Command -> Command
dontCheck check cmd = mutateCheck cmd $ \c -> filter (/= check) c
addCheck :: Annex () -> Command -> Command
addCheck check cmd = mutateCheck cmd $ \c ->
CommandCheck (length c + 100) check : c
mutateCheck :: Command -> ([CommandCheck] -> [CommandCheck]) -> Command
mutateCheck cmd@(Command { cmdcheck = c }) a = cmd { cmdcheck = a c }
Jump to Line
Something went wrong with that request. Please try again.