| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
System.Handsy
Contents
- type Handsy a = ProgramT HandsyInstruction IO a
- run :: Options -> Handsy a -> IO a
- shell :: String -> CommandOptions -> Handsy (ExitCode, ByteString, ByteString)
- command :: FilePath -> [String] -> CommandOptions -> Handsy (ExitCode, ByteString, ByteString)
- readFile :: FilePath -> Handsy ByteString
- writeFile :: FilePath -> ByteString -> Handsy ()
- appendFile :: FilePath -> ByteString -> Handsy ()
- shell_ :: String -> CommandOptions -> Handsy (ByteString, ByteString)
- command_ :: FilePath -> [String] -> CommandOptions -> Handsy (ByteString, ByteString)
- data CommandOptions = CommandOptions {
- stdin :: ByteString
- cwd :: String
- data Options = Options {}
- data ExitCode :: *
- def :: Default a => a
Documentation
Commands
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"}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 CommandOptions Source
Constructors
| CommandOptions | |
Fields
| |
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 | |
| ListLikeProcessIO a c => ProcessOutput a (ExitCode, a, a) | |
| IsReturnValue (ExitCode, ByteString, ByteString) | |
| type Rep ExitCode = D1 D1ExitCode ((:+:) (C1 C1_0ExitCode U1) (C1 C1_1ExitCode (S1 NoSelector (Rec0 Int)))) |