Copyright | © 2015-Present Stack Builders |
---|---|
License | MIT |
Maintainer | Juan Paucar <jpaucar@stackbuilders.com> |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Collection of type safe shell commands that can be fed into
runCommand
.
Synopsis
- class Command a where
- type Result a :: *
- renderCommand :: a -> String
- parseResult :: Proxy a -> String -> Result a
- data Whoami = Whoami
- data Cd cmd = Cd (Path Abs Dir) cmd
- data MkDir = MkDir (Path Abs Dir)
- data Rm where
- data Mv t = Mv TargetSystem (Path Abs t) (Path Abs t)
- data Ln where
- data Readlink t = Readlink TargetSystem (Path Abs File)
- data Ls = Ls (Path Abs Dir)
- data Find t = Find Natural (Path Abs Dir)
- data Touch = Touch (Path Abs File)
- data GitCheckout = GitCheckout String
- data GitClone = GitClone Bool (Either String (Path Abs Dir)) (Path Abs Dir)
- data GitFetch = GitFetch String
- data GitReset = GitReset String
- data GenericCommand = GenericCommand String
- mkGenericCommand :: String -> Maybe GenericCommand
- unGenericCommand :: GenericCommand -> String
- readScript :: MonadIO m => Path Abs File -> m [GenericCommand]
- formatCmd :: String -> [Maybe String] -> String
- quoteCmd :: String -> String
- trim :: String -> String
- isLinux :: TargetSystem -> Bool
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
Command GenericCommand Source # | |
Defined in System.Hapistrano.Commands.Internal type Result GenericCommand :: Type Source # renderCommand :: GenericCommand -> String Source # parseResult :: Proxy GenericCommand -> String -> Result GenericCommand Source # | |
Command GitReset Source # | |
Command GitFetch Source # | |
Command GitClone Source # | |
Command GitCheckout Source # | |
Defined in System.Hapistrano.Commands.Internal type Result GitCheckout :: Type Source # renderCommand :: GitCheckout -> String Source # parseResult :: Proxy GitCheckout -> String -> Result GitCheckout Source # | |
Command Touch Source # | |
Command Ls Source # | |
Command Ln Source # | |
Command Rm Source # | |
Command MkDir Source # | |
Command Whoami Source # | |
Command (Find File) Source # | |
Command (Find Dir) Source # | |
Command (Readlink File) Source # | |
Command (Readlink Dir) Source # | |
Command (Mv File) Source # | |
Command (Mv Dir) Source # | |
Command cmd => Command (Cd cmd) Source # | |
Unix whoami
.
Specify directory in which to perform another command.
Create a directory. Does not fail if the directory already exists.
Delete file or directory.
Move or rename files or directories.
Create symlinks.
Read link.
ls
, so far used only to check existence of directories, so it's not
very functional right now.
Find (a very limited version).
touch
.
data GitCheckout Source #
Git checkout.
Instances
Command GitCheckout Source # | |
Defined in System.Hapistrano.Commands.Internal type Result GitCheckout :: Type Source # renderCommand :: GitCheckout -> String Source # parseResult :: Proxy GitCheckout -> String -> Result GitCheckout Source # | |
type Result GitCheckout Source # | |
Defined in System.Hapistrano.Commands.Internal |
Git clone.
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.
isLinux :: TargetSystem -> Bool Source #
Determines whether or not the target system is a Linux machine.