module Manatee.Plugin.Anything.AnythingInteractiveFile where
import Data.ByteString.UTF8 hiding (drop, length)
import Manatee.Plugin.Anything.Anything
import Manatee.Plugin.Anything.AnythingInteractive
import Manatee.Plugin.Anything.AnythingLocate
import Manatee.Plugin.Anything.Types
import System.FilePath
anythingInteractiveFile :: Anything
anythingInteractiveFile =
Anything {anythingColumnTitle = ["InteractiveFile", "Size"]
,anythingColumnFun = anythingLocateColumnFun
,anythingSearch = AnythingSearch (anythingLocateSearch False)
,anythingFilterRule = anythingLocateFilterRule
,anythingCompletionRule = takeFileName
,anythingInputDepend = True
,anythingCommandFun = anythingInteractiveFileCommandFun
,anythingCalculateDelay = 0
}
anythingInteractiveFileCommandFun :: AnythingCommandFun
anythingInteractiveFileCommandFun _ wrap iType
= return [("Return file", anythingInteractiveActionReturn iType filepath)]
where path = fileInfoPath $ anythingCandidateUnpack wrap
filepath = toString path