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

Safe HaskellNone
LanguageHaskell2010

System.Handsy

Contents

Synopsis

Documentation

type Handsy = FreeT HandsyF IO Source

Main monad

run :: Options -> Handsy a -> IO a Source

Executes the actions locally

Commands

shell Source

Arguments

:: String

String to execute

-> CommandOptions 
-> Handsy (ExitCode, ByteString, ByteString)

(ExitCode, Stdout, Stderr)

Executes the given string in shell. Example:

shell "ls" $~ def{cwd="/var/www"}

command Source

Arguments

:: FilePath

Command to run

-> [String]

Arguments

-> CommandOptions 
-> 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_ :: String -> CommandOptions -> Handsy (ByteString, ByteString) Source

Same as shell, but ExitFailure is a runtime error.

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

Same as command, but ExitFailure is a runtime error.

Options

data Options Source

Constructors

Options 

Fields

debug :: Bool

Log commands to stderr before running

Instances

Re-exports

data ExitCode :: *

Defines the exit codes that a program can return.

Constructors

ExitSuccess

indicates successful termination;

ExitFailure Int

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).

Instances

Eq ExitCode 
Ord ExitCode 
Read ExitCode 
Show ExitCode 
Exception ExitCode 
Monoid ExitCode

A process usually has one ExitCode at the end of its output, this Monoid instance lets us build the type returned by readProcessWithExitCode.

Typeable * ExitCode 
ListLikeProcessIO a c => ProcessOutput a (ExitCode, a, a) 
IsReturnValue (ExitCode, ByteString, ByteString) 

def :: Default a => a

The default value for this type.