shell-escape-0.2.0: Shell escaping library.
Safe HaskellNone
LanguageHaskell98

Data.ByteString.ShellEscape

Description

Typed shell escaping for Bourne Shell and Bash.

Synopsis

Documentation

class Escape t where Source #

A type class for objects that represent an intermediate state of escaping.

Methods

escape :: ByteString -> t Source #

Transform a ByteString into the escaped intermediate form.

unescape :: t -> ByteString Source #

Recover the original ByteString.

bytes :: t -> ByteString Source #

Yield the escaped ByteString.

data Sh Source #

A Bourne Shell escaped ByteString. An oddity of Bourne shell escaping is the absence of escape codes for newline and other ASCII control characters. These bytes are simply placed literally in single quotes; the effect is that a Bourne Shell escaped string may cover several lines and contain non-ASCII bytes. Runs of bytes that must be escaped are wrapped in '...'; bytes that are acceptable as literals in Bourne Shell are left as is.

Instances

Instances details
Show Sh Source # 
Instance details

Defined in Data.ByteString.ShellEscape.Sh

Methods

showsPrec :: Int -> Sh -> ShowS #

show :: Sh -> String #

showList :: [Sh] -> ShowS #

Eq Sh Source # 
Instance details

Defined in Data.ByteString.ShellEscape.Sh

Methods

(==) :: Sh -> Sh -> Bool #

(/=) :: Sh -> Sh -> Bool #

Ord Sh Source # 
Instance details

Defined in Data.ByteString.ShellEscape.Sh

Methods

compare :: Sh -> Sh -> Ordering #

(<) :: Sh -> Sh -> Bool #

(<=) :: Sh -> Sh -> Bool #

(>) :: Sh -> Sh -> Bool #

(>=) :: Sh -> Sh -> Bool #

max :: Sh -> Sh -> Sh #

min :: Sh -> Sh -> Sh #

Escape Sh Source # 
Instance details

Defined in Data.ByteString.ShellEscape.Sh

sh :: ByteString -> Sh Source #

Construct a Bourne Shell escaped intermediate form.

data Bash Source #

A Bash escaped ByteString. The strings are wrapped in $'...' if any bytes within them must be escaped; otherwise, they are left as is. Newlines and other control characters are represented as ANSI escape sequences. High bytes are represented as hex codes. Thus Bash escaped strings will always fit on one line and never contain non-ASCII bytes.

Instances

Instances details
Show Bash Source # 
Instance details

Defined in Data.ByteString.ShellEscape.Bash

Methods

showsPrec :: Int -> Bash -> ShowS #

show :: Bash -> String #

showList :: [Bash] -> ShowS #

Eq Bash Source # 
Instance details

Defined in Data.ByteString.ShellEscape.Bash

Methods

(==) :: Bash -> Bash -> Bool #

(/=) :: Bash -> Bash -> Bool #

Ord Bash Source # 
Instance details

Defined in Data.ByteString.ShellEscape.Bash

Methods

compare :: Bash -> Bash -> Ordering #

(<) :: Bash -> Bash -> Bool #

(<=) :: Bash -> Bash -> Bool #

(>) :: Bash -> Bash -> Bool #

(>=) :: Bash -> Bash -> Bool #

max :: Bash -> Bash -> Bash #

min :: Bash -> Bash -> Bash #

Escape Bash Source # 
Instance details

Defined in Data.ByteString.ShellEscape.Bash

bash :: ByteString -> Bash Source #

Construct a Bash escaped intermediate form.