Merge branch 'master' into symlink-missing
This commit is contained in:
commit
26cf26caca
13 changed files with 100 additions and 43 deletions
|
@ -9,7 +9,7 @@ module Command.ExamineKey where
|
|||
|
||||
import Command
|
||||
import qualified Utility.Format
|
||||
import Command.Find (parseFormatOption, showFormatted, keyVars)
|
||||
import Command.Find (parseFormatOption, showFormatted, formatVars)
|
||||
import Annex.Link
|
||||
import Backend
|
||||
import Types.Backend
|
||||
|
@ -57,7 +57,7 @@ run o _ input = do
|
|||
showFormatted (format o) (serializeKey' k) $
|
||||
[ ("objectpath", fromRawFilePath objectpath)
|
||||
, ("objectpointer", fromRawFilePath objectpointer)
|
||||
] ++ keyVars k
|
||||
] ++ formatVars k af
|
||||
return True
|
||||
where
|
||||
-- Parse the input, which is either a key, or in batch mode
|
||||
|
|
|
@ -75,7 +75,8 @@ seek o = do
|
|||
|
||||
start :: FindOptions -> SeekInput -> RawFilePath -> Key -> CommandStart
|
||||
start o _ file key = startingCustomOutput key $ do
|
||||
showFormatted (formatOption o) file $ ("file", fromRawFilePath file) : keyVars key
|
||||
showFormatted (formatOption o) file
|
||||
(formatVars key (AssociatedFile (Just file)))
|
||||
next $ return True
|
||||
|
||||
startKeys :: FindOptions -> (SeekInput, Key, ActionItem) -> CommandStart
|
||||
|
@ -92,8 +93,9 @@ showFormatted format unformatted vars =
|
|||
Utility.Format.format formatter $
|
||||
M.fromList vars
|
||||
|
||||
keyVars :: Key -> [(String, String)]
|
||||
keyVars key =
|
||||
formatVars :: Key -> AssociatedFile -> [(String, String)]
|
||||
formatVars key (AssociatedFile af) =
|
||||
(maybe id (\f l -> (("file", fromRawFilePath f) : l)) af)
|
||||
[ ("key", serializeKey key)
|
||||
, ("backend", decodeBS $ formatKeyVariety $ fromKey keyVariety key)
|
||||
, ("bytesize", size show)
|
||||
|
|
|
@ -95,10 +95,8 @@ perform o remotemap key ai = do
|
|||
|
||||
mapM_ (showRemoteUrls remotemap) urls
|
||||
Just formatter -> liftIO $ do
|
||||
let vs = catMaybes
|
||||
[ fmap (("file",) . fromRawFilePath)
|
||||
(actionItemWorkTreeFile ai)
|
||||
] ++ Command.Find.keyVars key
|
||||
let vs = Command.Find.formatVars key
|
||||
(AssociatedFile (actionItemWorkTreeFile ai))
|
||||
let showformatted muuid murl = putStr $
|
||||
Utility.Format.format formatter $
|
||||
M.fromList $ vs ++ catMaybes
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue