diff options
author | Joey Hess <joey@kitenet.net> | 2010-10-21 16:30:16 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2010-10-21 16:30:16 -0400 |
commit | 19fde4960dc1d6c8c05efd0f5b4293c2fb52ebf9 (patch) | |
tree | 81071cf95d64b2c3f2d206d6dc30b6154a524b22 /TypeInternals.hs | |
parent | a68e36f518589bd15fea32da273ad6fd2f288bb5 (diff) |
new fromkey subcommand, for registering urls, etc0.01
had to redo Annex monad's flag storage
Diffstat (limited to 'TypeInternals.hs')
-rw-r--r-- | TypeInternals.hs | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/TypeInternals.hs b/TypeInternals.hs index 4a9d2653e..6d1c72d2e 100644 --- a/TypeInternals.hs +++ b/TypeInternals.hs @@ -7,12 +7,15 @@ module TypeInternals where import Control.Monad.State (StateT) import Data.String.Utils +import qualified Data.Map as M import qualified GitRepo as Git -data Flag = - Force | -- command-line flags - RemotesRead -- indicates that remote repo configs have been read +-- command-line flags +type FlagName = String +data Flag = + FlagBool Bool | + FlagString String deriving (Eq, Read, Show) -- git-annex's runtime state type doesn't really belong here, @@ -21,7 +24,7 @@ data AnnexState = AnnexState { repo :: Git.Repo, backends :: [Backend], supportedBackends :: [Backend], - flags :: [Flag] + flags :: M.Map FlagName Flag } deriving (Show) -- git-annex's monad @@ -32,6 +35,10 @@ type KeyFrag = String type BackendName = String data Key = Key (BackendName, KeyFrag) deriving (Eq) +-- constructs a key in a backend +genKey :: Backend -> KeyFrag -> Key +genKey b f = Key (name b,f) + -- show a key to convert it to a string; the string includes the -- name of the backend to avoid collisions between key strings instance Show Key where @@ -48,10 +55,6 @@ instance Read Key where backendName :: Key -> BackendName backendName (Key (b,k)) = b --- pulls the key fragment out -keyFrag :: Key -> KeyFrag -keyFrag (Key (b,k)) = k - -- this structure represents a key-value backend data Backend = Backend { -- name of this backend |