summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-03-17 15:26:18 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-03-17 15:26:18 -0400
commit48adf75275455ac7ff3e13d31ee7b1e90818ec40 (patch)
tree77744ea4fa9670e82775bd588d028d49a03508b4
parent8d52678e5bc07efa0211e138de76e24f1f34de2e (diff)
close
-rw-r--r--Command/MetaData.hs28
-rw-r--r--debian/changelog1
-rw-r--r--doc/bugs/Bug_Report_doesn__39__t_work.mdwn2
3 files changed, 25 insertions, 6 deletions
diff --git a/Command/MetaData.hs b/Command/MetaData.hs
index d49c8429d..46d112162 100644
--- a/Command/MetaData.hs
+++ b/Command/MetaData.hs
@@ -18,10 +18,19 @@ import qualified Data.Set as S
import Data.Time.Clock.POSIX
def :: [Command]
-def = [withOptions [setOption, tagOption, untagOption, getOption, jsonOption] $
+def = [withOptions metaDataOptions $
command "metadata" paramPaths seek
SectionMetaData "sets metadata of a file"]
+metaDataOptions :: [Option]
+metaDataOptions =
+ [ setOption
+ , tagOption
+ , untagOption
+ , getOption
+ , jsonOption
+ ] ++ keyOptions
+
storeModMeta :: ModMeta -> Annex ()
storeModMeta modmeta = Annex.changeState $
\s -> s { Annex.modmeta = modmeta:Annex.modmeta s }
@@ -50,13 +59,22 @@ seek ps = do
getfield <- getOptionField getOption $ \ms ->
return $ either error id . mkMetaField <$> ms
now <- liftIO getPOSIXTime
- withFilesInGit (whenAnnexed $ start now getfield modmeta) ps
+ withKeyOptions
+ (startKeys now getfield modmeta)
+ (withFilesInGit (whenAnnexed $ start now getfield modmeta))
+ ps
start :: POSIXTime -> Maybe MetaField -> [ModMeta] -> FilePath -> (Key, Backend) -> CommandStart
-start now Nothing ms file (k, _) = do
- showStart "metadata" file
+start now f ms file (k, _) = start' (Just file) now f ms k
+
+startKeys :: POSIXTime -> Maybe MetaField -> [ModMeta] -> Key -> CommandStart
+startKeys = start' Nothing
+
+start' :: AssociatedFile -> POSIXTime -> Maybe MetaField -> [ModMeta] -> Key -> CommandStart
+start' afile now Nothing ms k = do
+ showStart' "metadata" k afile
next $ perform now ms k
-start _ (Just f) _ _ (k, _) = do
+start' _ _ (Just f) _ k = do
l <- S.toList . currentMetaDataValues f <$> getCurrentMetaData k
liftIO $ forM_ l $
putStrLn . fromMetaValue
diff --git a/debian/changelog b/debian/changelog
index 56cfe88e0..d4224d5a3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -23,6 +23,7 @@ git-annex (5.20140307) UNRELEASED; urgency=medium
* vicfg: Allows editing preferred content expressions for groups.
* groupwanted can be used in preferred content expressions.
* metadata: Add --get
+ * metadata: Support --key option (and some other ones like --all)
-- Joey Hess <joeyh@debian.org> Thu, 06 Mar 2014 16:17:01 -0400
diff --git a/doc/bugs/Bug_Report_doesn__39__t_work.mdwn b/doc/bugs/Bug_Report_doesn__39__t_work.mdwn
index a77520bed..cbf4a481d 100644
--- a/doc/bugs/Bug_Report_doesn__39__t_work.mdwn
+++ b/doc/bugs/Bug_Report_doesn__39__t_work.mdwn
@@ -17,4 +17,4 @@ Bug Report doesn't work
# End of transcript or log.
"""]]
-[[fixed]] --[[Joey]]
+[[fixed|done]] --[[Joey]]