htags-1.0.1: src/ExCommand.hs
module ExCommand
( ExCommand
, exGotoLine
, exSearch
, exToStr
) where
import Control.Applicative
newtype ExCommand = EC String
exToStr (EC s) = s
exGotoLine :: Int -> ExCommand
exGotoLine i = EC (show i)
-- TODO: maybe use this later to search to get to the appropriate tag.
exSearch :: String -> ExCommand
exSearch s = EC ("/^" ++ exEscape s ++ "/")
where
exEscape = concatMap f
where
f '\\' = "\\\\"
f a = pure a