close
This commit is contained in:
parent
1d5210fd87
commit
b4d12855d6
3 changed files with 25 additions and 6 deletions
|
@ -18,10 +18,19 @@ import qualified Data.Set as S
|
||||||
import Data.Time.Clock.POSIX
|
import Data.Time.Clock.POSIX
|
||||||
|
|
||||||
def :: [Command]
|
def :: [Command]
|
||||||
def = [withOptions [setOption, tagOption, untagOption, getOption, jsonOption] $
|
def = [withOptions metaDataOptions $
|
||||||
command "metadata" paramPaths seek
|
command "metadata" paramPaths seek
|
||||||
SectionMetaData "sets metadata of a file"]
|
SectionMetaData "sets metadata of a file"]
|
||||||
|
|
||||||
|
metaDataOptions :: [Option]
|
||||||
|
metaDataOptions =
|
||||||
|
[ setOption
|
||||||
|
, tagOption
|
||||||
|
, untagOption
|
||||||
|
, getOption
|
||||||
|
, jsonOption
|
||||||
|
] ++ keyOptions
|
||||||
|
|
||||||
storeModMeta :: ModMeta -> Annex ()
|
storeModMeta :: ModMeta -> Annex ()
|
||||||
storeModMeta modmeta = Annex.changeState $
|
storeModMeta modmeta = Annex.changeState $
|
||||||
\s -> s { Annex.modmeta = modmeta:Annex.modmeta s }
|
\s -> s { Annex.modmeta = modmeta:Annex.modmeta s }
|
||||||
|
@ -50,13 +59,22 @@ seek ps = do
|
||||||
getfield <- getOptionField getOption $ \ms ->
|
getfield <- getOptionField getOption $ \ms ->
|
||||||
return $ either error id . mkMetaField <$> ms
|
return $ either error id . mkMetaField <$> ms
|
||||||
now <- liftIO getPOSIXTime
|
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 :: POSIXTime -> Maybe MetaField -> [ModMeta] -> FilePath -> (Key, Backend) -> CommandStart
|
||||||
start now Nothing ms file (k, _) = do
|
start now f ms file (k, _) = start' (Just file) now f ms k
|
||||||
showStart "metadata" file
|
|
||||||
|
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
|
next $ perform now ms k
|
||||||
start _ (Just f) _ _ (k, _) = do
|
start' _ _ (Just f) _ k = do
|
||||||
l <- S.toList . currentMetaDataValues f <$> getCurrentMetaData k
|
l <- S.toList . currentMetaDataValues f <$> getCurrentMetaData k
|
||||||
liftIO $ forM_ l $
|
liftIO $ forM_ l $
|
||||||
putStrLn . fromMetaValue
|
putStrLn . fromMetaValue
|
||||||
|
|
1
debian/changelog
vendored
1
debian/changelog
vendored
|
@ -23,6 +23,7 @@ git-annex (5.20140307) UNRELEASED; urgency=medium
|
||||||
* vicfg: Allows editing preferred content expressions for groups.
|
* vicfg: Allows editing preferred content expressions for groups.
|
||||||
* groupwanted can be used in preferred content expressions.
|
* groupwanted can be used in preferred content expressions.
|
||||||
* metadata: Add --get
|
* 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
|
-- Joey Hess <joeyh@debian.org> Thu, 06 Mar 2014 16:17:01 -0400
|
||||||
|
|
||||||
|
|
|
@ -17,4 +17,4 @@ Bug Report doesn't work
|
||||||
# End of transcript or log.
|
# End of transcript or log.
|
||||||
"""]]
|
"""]]
|
||||||
|
|
||||||
[[fixed]] --[[Joey]]
|
[[fixed|done]] --[[Joey]]
|
||||||
|
|
Loading…
Add table
Reference in a new issue