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?
This commit is contained in:
Joey Hess 2011-11-22 14:06:31 -04:00
parent fc2f0e8b1a
commit 7f7ae7a3b1
6 changed files with 17 additions and 2 deletions

View file

@ -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