prep for fixing find --branch --unlocked
Added LinkType to ProvidedInfo, and unified MatchingKey with ProvidedInfo. They're both used in the same way, so there was no real reason to keep separate. Note that addLocked and addUnlocked still set matchNeedsFileName, because to handle MatchingFile, they do need it. However, they don't use it when MatchingInfo is provided. This should be ok, the --branch case will be able skip checking matchNeedsFileName, since it will provide a filename in any case.
This commit is contained in:
parent
ee4fd38ecf
commit
cbf94fd13d
10 changed files with 91 additions and 46 deletions
|
@ -194,9 +194,24 @@ withKeyOptions ko auto seeker keyaction = withKeyOptions' ko auto mkkeyaction
|
|||
return $ \v@(_si, k, ai) -> checkseeker k $
|
||||
let i = case ai of
|
||||
ActionItemBranchFilePath (BranchFilePath _ topf) _ ->
|
||||
MatchingKey k (AssociatedFile $ Just $ getTopFilePath topf)
|
||||
_ -> MatchingKey k (AssociatedFile Nothing)
|
||||
in whenM (matcher i) $
|
||||
ProvidedInfo
|
||||
{ providedFilePath = Just $
|
||||
getTopFilePath topf
|
||||
, providedKey = Just k
|
||||
, providedFileSize = Nothing
|
||||
, providedMimeType = Nothing
|
||||
, providedMimeEncoding = Nothing
|
||||
, providedLinkType = Nothing
|
||||
}
|
||||
_ -> ProvidedInfo
|
||||
{ providedFilePath = Nothing
|
||||
, providedKey = Just k
|
||||
, providedFileSize = Nothing
|
||||
, providedMimeType = Nothing
|
||||
, providedMimeEncoding = Nothing
|
||||
, providedLinkType = Nothing
|
||||
}
|
||||
in whenM (matcher (MatchingInfo i)) $
|
||||
keyaction v
|
||||
checkseeker k a = case checkContentPresent seeker of
|
||||
Nothing -> a
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue