module Manatee.Plugin.Anything.AnythingInteractiveDirectory 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
anythingInteractiveDirectory :: Anything
anythingInteractiveDirectory =
Anything {anythingColumnTitle = ["InteractiveDirectory", "Size"]
,anythingColumnFun = anythingLocateColumnFun
,anythingSearch = AnythingSearch (anythingLocateSearch True)
,anythingFilterRule = anythingLocateFilterRule
,anythingCompletionRule = takeFileName
,anythingInputDepend = True
,anythingCommandFun = anythingInteractiveDirectoryCommandFun
,anythingCalculateDelay = 0
}
anythingInteractiveDirectoryCommandFun :: AnythingCommandFun
anythingInteractiveDirectoryCommandFun _ wrap iType
= return [("Return directory", anythingInteractiveActionReturn iType filepath)]
where path = fileInfoPath $ anythingCandidateUnpack wrap
filepath = toString path