summaryrefslogtreecommitdiff
path: root/GitAnnex.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-01-06 03:06:25 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-01-06 03:16:42 -0400
commit0a36f92a31196451c2d838fd0ae15527e8bbce18 (patch)
tree54e2a90339ad3d24dbc3d0599a580db63b25ed32 /GitAnnex.hs
parent2051d804625be0c19e277764ab9820b428a5d2b3 (diff)
more command-specific options
Made --from and --to command-specific options. Added generic storage for values of command-specific options, which allows removing some of the special case fields in AnnexState. (Also added generic storage for command-specific flags, although there are not yet any.) Note that this storage uses a Map, so repeatedly looking up the same value is slightly more expensive than looking up an AnnexState field. But, the value can be looked up once in the seek stage, transformed as necessary, and passed in a closure to the start stage, and this avoids that overhead. Still, I'm hesitant to use this for things like force or fast flags. It's probably best to reserve it for flags that are only used by a few commands, or options like --from and --to that it's important only be allowed to be used with commands that implement them, to avoid user confusion.
Diffstat (limited to 'GitAnnex.hs')
-rw-r--r--GitAnnex.hs8
1 files changed, 1 insertions, 7 deletions
diff --git a/GitAnnex.hs b/GitAnnex.hs
index 3ce451810..8af1d5d59 100644
--- a/GitAnnex.hs
+++ b/GitAnnex.hs
@@ -94,11 +94,7 @@ cmds = concat
options :: [Option]
options = commonOptions ++
- [ Option ['t'] ["to"] (ReqArg setto paramRemote)
- "specify to where to transfer content"
- , Option ['f'] ["from"] (ReqArg setfrom paramRemote)
- "specify from where to transfer content"
- , Option ['N'] ["numcopies"] (ReqArg setnumcopies paramNumber)
+ [ Option ['N'] ["numcopies"] (ReqArg setnumcopies paramNumber)
"override default number of copies"
, Option [] ["trust"] (ReqArg (Remote.forceTrust Trusted) paramRemote)
"override trust setting"
@@ -120,8 +116,6 @@ options = commonOptions ++
"skip files not using a key-value backend"
] ++ matcherOptions
where
- setto v = Annex.changeState $ \s -> s { Annex.toremote = Just v }
- setfrom v = Annex.changeState $ \s -> s { Annex.fromremote = Just v }
setnumcopies v = Annex.changeState $ \s -> s {Annex.forcenumcopies = readMaybe v }
setgitconfig :: String -> Annex ()
setgitconfig v = do