bash-0.1.6: Bash generation library.

Safe HaskellNone

Language.Bash.Script

Description

Utilities for turning statements into full scripts.

Synopsis

Documentation

script :: Annotation t => Statement t -> BuilderSource

Produce a script beginning with #!/bin/bash and a safe set statement.

script_sha1 :: forall t t'. (Annotation t, Annotation t') => ByteString -> Statement t -> Statement t' -> BuilderSource

Produce a script beginning with #!/bin/bash and some (optional) documentation. Cause the script to be scanned for SHA-1 hash of the setup (first statement argument) and main (second statement argument) before running the safe set statement and running the second argument.

tokenCheck :: ByteString -> Statement t -> Statement (Statements t t')Source

Scan $0 for the token before running, producing a statement annotated with the initial statement. This is a bit clumsy but is used internally.

mtokenCheck :: Monoid t => ByteString -> (Statement t -> t) -> Statement t -> Statement tSource

Scan $0 for the token before running, correctly producing monoidal annotations. The function argument provides an annotation for the fgrep check generated to search for the token. (const mempty would be appropriate in most cases.)

sha1Check :: (Annotation t, Annotation t') => Statement t -> Statement (Statements t t')Source

Scan $0 the SHA1 of the statement before running.

dance :: Statement t -> Annotated (Statements t t')Source

The noop dance -- annotate a NoOp with a statement, essentially as a type coercion.