diff options
author | Joey Hess <joey@kitenet.net> | 2011-06-02 02:33:31 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-06-02 02:33:31 -0400 |
commit | f2cc87860ccb4ccb4a51dd9d255717a0e749fe76 (patch) | |
tree | aae721cc4157e1ed566aa7f5b42fc30c4c2dd4cf | |
parent | 76be8c34acfacfc884b3fdd086bcf60b28570237 (diff) |
refactor
-rw-r--r-- | GitAnnex.hs | 9 | ||||
-rw-r--r-- | Remote.hs | 6 |
2 files changed, 9 insertions, 6 deletions
diff --git a/GitAnnex.hs b/GitAnnex.hs index 2a9fcbe3e..b22313d3c 100644 --- a/GitAnnex.hs +++ b/GitAnnex.hs @@ -95,11 +95,11 @@ options = commonOptions ++ "skip files matching the glob pattern" , Option ['N'] ["numcopies"] (ReqArg setnumcopies paramNumber) "override default number of copies" - , Option [] ["trust"] (ReqArg (settrust Trusted) paramRemote) + , Option [] ["trust"] (ReqArg (Remote.forceTrust Trusted) paramRemote) "override trust setting" - , Option [] ["semitrust"] (ReqArg (settrust SemiTrusted) paramRemote) + , Option [] ["semitrust"] (ReqArg (Remote.forceTrust SemiTrusted) paramRemote) "override trust setting back to default value" - , Option [] ["untrust"] (ReqArg (settrust UnTrusted) paramRemote) + , Option [] ["untrust"] (ReqArg (Remote.forceTrust UnTrusted) paramRemote) "override trust setting to untrusted" ] where @@ -108,9 +108,6 @@ options = commonOptions ++ addexclude v = Annex.changeState $ \s -> s { Annex.exclude = v:Annex.exclude s } setnumcopies v = Annex.changeState $ \s -> s {Annex.forcenumcopies = readMaybe v } setkey v = Annex.changeState $ \s -> s { Annex.defaultkey = Just v } - settrust t v = do - r <- Remote.nameToUUID v - Annex.changeState $ \s -> s { Annex.forcetrust = (r, t):Annex.forcetrust s } header :: String header = "Usage: git-annex command [option ..]" @@ -15,6 +15,7 @@ module Remote ( hasKey, hasKeyCheap, keyPossibilities, + forceTrust, remoteTypes, genList, @@ -137,6 +138,11 @@ keyPossibilities key = do return (sort validremotes, validtrusteduuids) +forceTrust :: TrustLevel -> String -> Annex () +forceTrust level remotename = do + r <- Remote.nameToUUID remotename + Annex.changeState $ \s -> + s { Annex.forcetrust = (r, level):Annex.forcetrust s } {- Filename of remote.log. -} remoteLog :: Annex FilePath |