handsy-0.0.6: A DSL to describe common shell operations and interpeters for running them locally and remotely.

Safe HaskellNone
LanguageHaskell2010

System.Handsy

Contents

Synopsis

Documentation

Actions

command Source

Arguments

:: FilePath

Command to run

-> [String]

Arguments

-> ByteString

Standart Input

-> Handsy (ExitCode, ByteString, ByteString)

(status, stdout, stderr)

Runs a command

readFile :: FilePath -> Handsy ByteString Source

Reads a file and returns the contents of the file.

writeFile :: FilePath -> ByteString -> Handsy () Source

writeFile file str function writes the bytestring str, to the file file.

appendFile :: FilePath -> ByteString -> Handsy () Source

appendFile file str function appends the bytestring str, to the file file.

Helpers

shell Source

Arguments

:: String

String to execute

-> ByteString

Standart input

-> Handsy (ExitCode, ByteString, ByteString)

(ExitCode, Stdout, Stderr)

Executes the given string in shell

shell cmd stdin = command "/usr/bin/env" ["sh", "-c", cmd] stdin

shell_ :: String -> ByteString -> Handsy (ByteString, ByteString) Source

Same as shell, but ExitFailure is a runtime error.

command_ :: FilePath -> [String] -> ByteString -> Handsy (ByteString, ByteString) Source

Same as command, but ExitFailure is a runtime error.

Interpreter

run :: Handsy a -> IO a Source

Executes the actions locally