-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A DSL to describe common shell operations and interpeters for running them locally and remotely. -- @package handsy @version 0.0.9 module System.Handsy.Core -- | Main monad type Handsy = FreeT HandsyF IO interpret :: IO r -> (r -> IO ()) -> (r -> String -> [String] -> ByteString -> IO (ExitCode, ByteString, ByteString)) -> Options -> Handsy a -> IO a interpretSimple :: (String -> [String] -> ByteString -> IO (ExitCode, ByteString, ByteString)) -> Options -> Handsy a -> IO a command :: MonadFree HandsyF m_a6kt => FilePath -> [String] -> ByteString -> m_a6kt (ExitCode, ByteString, ByteString) data Options Options :: Bool -> Options -- | Log commands to stderr before running debug :: Options -> Bool -- | Default options options :: Options instance Functor HandsyF module System.Handsy -- | Main monad type Handsy = FreeT HandsyF IO -- | Executes the actions locally run :: Options -> Handsy a -> IO a -- | Runs a command command :: FilePath -> [String] -> ByteString -> Handsy (ExitCode, ByteString, ByteString) -- | Reads a file and returns the contents of the file. readFile :: FilePath -> Handsy ByteString -- | writeFile file str function writes the bytestring -- str, to the file file. writeFile :: FilePath -> ByteString -> Handsy () -- | appendFile file str function appends the bytestring -- str, to the file file. appendFile :: FilePath -> ByteString -> Handsy () -- | Executes the given string in shell -- --
-- shell cmd stdin = command "/usr/bin/env" ["sh", "-c", cmd] stdin --shell :: String -> ByteString -> Handsy (ExitCode, ByteString, ByteString) -- | Same as command, but ExitFailure is a runtime error. command_ :: FilePath -> [String] -> ByteString -> Handsy (ByteString, ByteString) -- | Same as shell, but ExitFailure is a runtime error. shell_ :: String -> ByteString -> Handsy (ByteString, ByteString) data Options Options :: Bool -> Options -- | Log commands to stderr before running debug :: Options -> Bool -- | Default options options :: Options -- | Defines the exit codes that a program can return. data ExitCode :: * -- | indicates successful termination; ExitSuccess :: ExitCode -- | indicates program failure with an exit code. The exact interpretation -- of the code is operating-system dependent. In particular, some values -- may be prohibited (e.g. 0 on a POSIX-compliant system). ExitFailure :: Int -> ExitCode module System.Handsy.Remote data RemoteOptions RemoteOptions :: (FilePath, [String]) -> RemoteOptions -- | Path of ssh command and command line arguments sshCommand :: RemoteOptions -> (FilePath, [String]) -- | Executes the actions at a remote host runRemote :: Options -> RemoteOptions -> Handsy a -> IO a -- | Copies a local file to remote host pushFile :: FilePath -> FilePath -> Handsy () -- | Fetches a file from remote host pullFile :: FilePath -> FilePath -> Handsy ()