diff --git a/Command/MetaData.hs b/Command/MetaData.hs index d49c8429d3..46d112162d 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 56cfe88e08..d4224d5a3d 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 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 a77520bed3..cbf4a481d2 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]]