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
|
||||
|
||||
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
|
||||
|
|
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.
|
||||
* 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
|
||||
|
||||
|
|
|
@ -17,4 +17,4 @@ Bug Report doesn't work
|
|||
# End of transcript or log.
|
||||
"""]]
|
||||
|
||||
[[fixed]] --[[Joey]]
|
||||
[[fixed|done]] --[[Joey]]
|
||||
|
|
Loading…
Add table
Reference in a new issue