summaryrefslogtreecommitdiff
path: root/GitAnnex.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-11-22 14:06:31 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-11-22 14:06:31 -0400
commit7f7ae7a3b1cdfbc61879189dfe04a637690015aa (patch)
tree842546a50ff6def034f19a0e6e5c616a66d9a9d5 /GitAnnex.hs
parentfc2f0e8b1a4bd016ac29606381dfb7034c88e9f5 (diff)
find: Support --print0
It would be nice if command-specific options were supported. The first difficulty is that which command is being called is not known until after getopt; but that could be worked around by finding the first non-dashed parameter. Storing the settings without putting them in the annex monad is the next difficulty; it could perhaps be handled by making the seek stage pass applicable settings into the start stage (and from there on to perform as needed). But that still leaves a problem, what data type to use to represent the options between getopt and seek?
Diffstat (limited to 'GitAnnex.hs')
-rw-r--r--GitAnnex.hs3
1 files changed, 3 insertions, 0 deletions
diff --git a/GitAnnex.hs b/GitAnnex.hs
index 7b51602be..f563c08cb 100644
--- a/GitAnnex.hs
+++ b/GitAnnex.hs
@@ -103,6 +103,8 @@ options = commonOptions ++
"override trust setting to untrusted"
, Option ['c'] ["config"] (ReqArg setgitconfig "NAME=VALUE")
"override git configuration setting"
+ , Option [] ["print0"] (NoArg (setprint0 True))
+ "terminate filename with null"
, Option ['x'] ["exclude"] (ReqArg Limit.addExclude paramGlob)
"skip files matching the glob pattern"
, Option ['i'] ["in"] (ReqArg Limit.addIn paramRemote)
@@ -114,6 +116,7 @@ options = commonOptions ++
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 }
+ setprint0 v = Annex.changeState $ \s -> s { Annex.print0 = v }
setgitconfig :: String -> Annex ()
setgitconfig v = do
newg <- inRepo $ Git.configStore v