Copyright | © 2015-Present Stack Builders |
---|---|
License | MIT |
Stability | experimental |
Portability | portable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Collection of type safe shell commands that can be fed into
runCommand
.
Synopsis
- class Command a where
- type Result a :: Type
- renderCommand :: a -> String
- parseResult :: Proxy a -> String -> Result a
- data Whoami = Whoami
- data Cd cmd = Cd (Path Abs Dir) cmd
- newtype MkDir = MkDir (Path Abs Dir)
- data Rm where
- data Mv t = Mv TargetSystem (Path Abs t) (Path Abs t)
- data Ln where
- newtype Ls = Ls (Path Abs Dir)
- data Readlink t = Readlink TargetSystem (Path Abs File)
- data Find t = Find Natural (Path Abs Dir)
- newtype Touch = Touch (Path Abs File)
- newtype Cat = Cat (Path Abs File)
- newtype CheckExists = CheckExists (Path Abs File)
- data BasicWrite = BasicWrite (Path Abs File) String
- newtype GitCheckout = GitCheckout String
- data GitClone = GitClone Bool (Either String (Path Abs Dir)) (Path Abs Dir)
- newtype GitSetOrigin = GitSetOrigin String
- newtype GitFetch = GitFetch String
- newtype GitReset = GitReset String
- data GenericCommand
- mkGenericCommand :: String -> Maybe GenericCommand
- unGenericCommand :: GenericCommand -> String
- readScript :: MonadIO m => Path Abs File -> m [GenericCommand]
Documentation
class Command a where Source #
Class for data types that represent shell commands in typed way.
renderCommand :: a -> String Source #
How to render the command before feeding it into shell (possibly via SSH).
parseResult :: Proxy a -> String -> Result a Source #
How to parse the result from stdout.
Instances
Unix whoami
.
Specify directory in which to perform another command.
Create a directory. Does not fail if the directory already exists.
Instances
Delete file or directory.
Move or rename files or directories.
Create symlinks.
ls
, so far used only to check existence of directories, so it's not
very functional right now.
Read link.
Find (a very limited version).
touch
.
Instances
Command used to read the contents of a particular file in the host.
newtype CheckExists Source #
Command that checks for the existance of a particular file in the host.
CheckExists (Path Abs File) | The absolute path to the file you want to check for existence |
Instances
Command CheckExists Source # | |
Defined in System.Hapistrano.Commands.Internal type Result CheckExists Source # renderCommand :: CheckExists -> String Source # parseResult :: Proxy CheckExists -> String -> Result CheckExists Source # | |
type Result CheckExists Source # | |
Defined in System.Hapistrano.Commands.Internal |
data BasicWrite Source #
Basic command that writes to a file some contents.
It uses the file > contents
shell syntax and the contents
is
represented as a String
, so it shouldn't be used for
bigger writing operations. Currently used to write fail
or success
to the .hapistrano_deploy_state
file.
Instances
Command BasicWrite Source # | |
Defined in System.Hapistrano.Commands.Internal type Result BasicWrite Source # renderCommand :: BasicWrite -> String Source # parseResult :: Proxy BasicWrite -> String -> Result BasicWrite Source # | |
type Result BasicWrite Source # | |
Defined in System.Hapistrano.Commands.Internal |
newtype GitCheckout Source #
Git checkout.
Instances
Command GitCheckout Source # | |
Defined in System.Hapistrano.Commands.Internal type Result GitCheckout Source # renderCommand :: GitCheckout -> String Source # parseResult :: Proxy GitCheckout -> String -> Result GitCheckout Source # | |
type Result GitCheckout Source # | |
Defined in System.Hapistrano.Commands.Internal |
Git clone.
newtype GitSetOrigin Source #
Git set origin
Instances
Command GitSetOrigin Source # | |
Defined in System.Hapistrano.Commands.Internal type Result GitSetOrigin Source # renderCommand :: GitSetOrigin -> String Source # parseResult :: Proxy GitSetOrigin -> String -> Result GitSetOrigin Source # | |
type Result GitSetOrigin Source # | |
Defined in System.Hapistrano.Commands.Internal |
Git fetch (simplified).
Git reset.
data GenericCommand Source #
Weakly-typed generic command, avoid using it directly.
Instances
mkGenericCommand :: String -> Maybe GenericCommand Source #
Smart constructor that allows to create GenericCommand
s. Just a
little bit more safety.
unGenericCommand :: GenericCommand -> String Source #
Get the raw command back from GenericCommand
.
readScript :: MonadIO m => Path Abs File -> m [GenericCommand] Source #
Read commands from a file.