Add --trust, --untrust, and --semitrust options.

This commit is contained in:
Joey Hess 2011-06-01 17:49:37 -04:00
parent 7a3d9d8c2e
commit a8fb97d2ce
12 changed files with 117 additions and 58 deletions

View file

@ -14,6 +14,7 @@ import CmdLine
import Command
import Options
import Utility
import TrustLevel
import qualified Annex
import qualified Command.Add
@ -83,7 +84,9 @@ cmds = concat
options :: [Option]
options = commonOptions ++
[ Option ['t'] ["to"] (ReqArg setto paramRemote)
[ Option ['k'] ["key"] (ReqArg setkey paramKey)
"specify a key to use"
, Option ['t'] ["to"] (ReqArg setto paramRemote)
"specify to where to transfer content"
, Option ['f'] ["from"] (ReqArg setfrom paramRemote)
"specify from where to transfer content"
@ -91,8 +94,12 @@ options = commonOptions ++
"skip files matching the glob pattern"
, Option ['N'] ["numcopies"] (ReqArg setnumcopies paramNumber)
"override default number of copies"
, Option ['k'] ["key"] (ReqArg setkey paramKey)
"specify a key to use"
, Option [] ["trust"] (ReqArg (settrust Trusted) paramRemote)
"override trust setting"
, Option [] ["semitrust"] (ReqArg (settrust SemiTrusted) paramRemote)
"override trust setting back to default value"
, Option [] ["untrust"] (ReqArg (settrust UnTrusted) paramRemote)
"override trust setting to untrusted"
]
where
setto v = Annex.changeState $ \s -> s { Annex.toremote = Just v }
@ -100,6 +107,7 @@ 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 = Annex.changeState $ \s -> s { Annex.forcetrust = (v, t):(Annex.forcetrust s) }
header :: String
header = "Usage: git-annex command [option ..]"