module Manatee.Plugin.Anything.AnythingInteractiveNumber where
import Data.Char
import DBus.Client hiding (Signal)
import Manatee.Plugin.Anything.Anything
import Manatee.Plugin.Anything.AnythingInteractive
import Manatee.Plugin.Anything.Types
anythingInteractiveNumber :: Anything
anythingInteractiveNumber =
Anything {anythingColumnTitle = ["InteractiveNumber"]
,anythingColumnFun = [anythingCandidateUnpack]
,anythingSearch = AnythingSearch anythingInteractiveNumberSearch
,anythingFilterRule = anythingFuzzyFilterRule True
,anythingCompletionRule = id
,anythingInputDepend = False
,anythingCommandFun = anythingInteractiveNumberCommandFun
,anythingCalculateDelay = 0
}
anythingInteractiveNumberSearch :: AnythingInput -> Client -> IO [String]
anythingInteractiveNumberSearch input _
| null input
= return []
| all isNumber input
= return [input]
| otherwise
= return []
anythingInteractiveNumberCommandFun :: AnythingCommandFun
anythingInteractiveNumberCommandFun input _ iType
= return [("Return Number", anythingInteractiveActionReturn iType input)]