-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Library for interacting with console applications via pseudoterminals. -- -- Bindings to libexpect. @package libexpect @version 0.3.0 -- | Provides a thin wrapper for the FFI bindings to libexpect contained in -- System.Expect.ExpectBindings. module System.Expect.ExpectInterface -- | Denotes how a case's pattern is treated. data ExpectType -- | Match against pattern exactly. ExpExact :: ExpectType -- | Compile the pattern string to a regex and match. ExpRegex :: ExpectType -- | Pattern string is glob style. ExpGlob :: ExpectType ExpNull :: ExpectType -- | Defines a case to match against. data ExpectCase ExpectCase :: String -> ExpectType -> Int -> ExpectCase -- | Pattern to match against. expectPattern :: ExpectCase -> String -- | Type of pattern contained in the case. expectType :: ExpectCase -> ExpectType -- | The value to return if the case is matched. expectValue :: ExpectCase -> Int -- | Proc created by spawnExpect. Contains both the CFile pointer and a -- Haskell handle, so the translation needs only be done once. data ExpectProc ExpectProc :: Ptr CFile -> Handle -> ExpectProc -- | Gets the pointer to the expect process file handle. expectFilePtr :: ExpectProc -> Ptr CFile -- | Gets a Handle to the expect process. expectHandle :: ExpectProc -> Handle -- | Child process does not echo output to stdout. muteExpect :: IO () -- | Child process echoes output to stdout. unmuteExpect :: IO () -- | Spawn a new expect process, running a specified program. spawnExpect :: String -> IO ExpectProc expectCases :: ExpectProc -> [ExpectCase] -> IO (Maybe Int) -- | Expect a single case with a given type. expectSingle :: ExpectProc -> String -> ExpectType -> IO (Maybe Int) -- | Expect a single case with a type of ExpExact. expectExact :: ExpectProc -> String -> IO (Maybe Int) -- | Expect a single case with a type of ExpExact. expectRegex :: ExpectProc -> String -> IO (Maybe Int) -- | Expect multiple cases of a given type. expectMultiple :: ExpectProc -> [String] -> ExpectType -> IO (Maybe Int) -- | Send a line of input to the process. sendLine :: ExpectProc -> String -> IO () module System.Expect module System.Expect.ExpectCombinators data ExpectM a ExpectM :: (Maybe ExpectProc -> IO (a, Maybe ExpectProc)) -> ExpectM a data ExpectOption a -- | Spawns the child process specified, and is used for all following -- actions. spawn :: String -> ExpectM () -- | Send a line to the current process. send :: String -> ExpectM () -- | Take a list of cases and run the action of the case that matches, or -- return a fail value in the case of no matches. switch :: [ExpectOption a] -> a -> ExpectM a -- | Wait for a pattern to match. wait :: ExpectType -> String -> ExpectM () -- | Construct an option for use with switch check :: ExpectType -> String -> ExpectM a -> ExpectOption a -- | Read N characters from the terminal. Note that this includes -- characters echoed from send actions. readStr :: Int -> ExpectM String -- | Mute expect. mute :: ExpectM () -- | Unmute expect. unmute :: ExpectM () -- | Run an ExpectM action. runExpect :: ExpectM a -> IO a -- | Run an ExpectM (IO a) action, and join the result, moving it from IO -- (IO a) to IO a. runExpectIO :: ExpectM (IO a) -> IO a instance Monad ExpectM