summaryrefslogtreecommitdiff
path: root/GitAnnex.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-12-22 18:31:44 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-12-22 18:31:44 -0400
commit06bafae9e016b4d65c023546516e51bd32b08649 (patch)
tree25ec8e4ed7a2ebcb5363df4284df8c690c30e1fe /GitAnnex.hs
parentcf496f09ab3777cc4ffe601e876b432dc320bd12 (diff)
Format strings can be specified using the new --find option, to control what is output by git annex find.
Diffstat (limited to 'GitAnnex.hs')
-rw-r--r--GitAnnex.hs10
1 files changed, 7 insertions, 3 deletions
diff --git a/GitAnnex.hs b/GitAnnex.hs
index 40ebed0d6..7243d69cb 100644
--- a/GitAnnex.hs
+++ b/GitAnnex.hs
@@ -18,6 +18,7 @@ import Types.TrustLevel
import qualified Annex
import qualified Remote
import qualified Limit
+import qualified Utility.Format
import qualified Command.Add
import qualified Command.Unannex
@@ -108,8 +109,10 @@ 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 [] ["print0"] (NoArg setprint0)
+ "terminate output with null"
+ , Option [] ["format"] (ReqArg setformat paramFormat)
+ "control format of output"
, Option ['x'] ["exclude"] (ReqArg Limit.addExclude paramGlob)
"skip files matching the glob pattern"
, Option ['I'] ["include"] (ReqArg Limit.addInclude paramGlob)
@@ -125,7 +128,8 @@ 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 }
+ setformat v = Annex.changeState $ \s -> s { Annex.format = Just $ Utility.Format.gen v }
+ setprint0 = setformat "${file}\0"
setgitconfig :: String -> Annex ()
setgitconfig v = do
newg <- inRepo $ Git.Config.store v