summaryrefslogtreecommitdiff
path: root/Annex.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2010-10-14 21:10:59 -0400
committerGravatar Joey Hess <joey@kitenet.net>2010-10-14 21:10:59 -0400
commit29039fdf97f541a1077c9af65ccbe09dd2ae2b28 (patch)
treed46d1c1489422352df166789cf9baeb56132501b /Annex.hs
parent4c3ad80f320d3c4cccc3e41e4f2364155bae22a1 (diff)
add flags, and change to subcommand style
Diffstat (limited to 'Annex.hs')
-rw-r--r--Annex.hs18
1 files changed, 17 insertions, 1 deletions
diff --git a/Annex.hs b/Annex.hs
index 9be86c948..9e76b9b04 100644
--- a/Annex.hs
+++ b/Annex.hs
@@ -7,6 +7,9 @@ module Annex (
gitRepoChange,
backends,
backendsChange,
+ flagIsSet,
+ flagsChange,
+ Flag(..)
) where
import Control.Monad.State
@@ -18,7 +21,11 @@ import qualified BackendTypes as Backend
-}
new :: Git.Repo -> IO AnnexState
new g = do
- let s = Backend.AnnexState { Backend.repo = g, Backend.backends = [] }
+ let s = Backend.AnnexState {
+ Backend.repo = g,
+ Backend.backends = [],
+ Backend.flags = []
+ }
(_,s') <- Annex.run s (prep g)
return s'
where
@@ -49,3 +56,12 @@ backendsChange b = do
state <- get
put state { Backend.backends = b }
return ()
+flagIsSet :: Flag -> Annex Bool
+flagIsSet flag = do
+ state <- get
+ return $ elem flag $ Backend.flags state
+flagsChange :: [Flag] -> Annex ()
+flagsChange b = do
+ state <- get
+ put state { Backend.flags = b }
+ return ()