-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Simple String-based process commands -- -- Simple wrappers over System.Process (readProcess, -- readProcessWithExitCode, rawSystem, and createProcess). The idea is to -- provide some common idioms for calling out to commands from programs. -- For more advanced shell-scripting or streaming use turtle, shelly, -- command, etc. @package simple-cmd @version 0.2.0 -- | Some simple String wrappers of readProcess, -- readProcessWithExitCode, rawSystem from the Haskell -- process library. -- -- Simplest is -- --
-- cmd_ :: String -> [String] -> IO () ---- -- which outputs to stdout. For example: -- --
-- cmd_ "git" ["clone", url] ---- -- Then -- --
-- cmd :: String -> [String] -> IO String ---- -- returns stdout as a String. -- -- There are also cmdBool, cmdMaybe, cmdLines, -- shell, and others. -- -- Other examples: -- --
-- grep_ pat file :: IO Bool ---- --
-- sudo c args :: IO () --module SimpleCmd -- | 'cmd c args' runs a command in a process and returns stdout cmd :: String -> [String] -> IO String -- | 'cmd_ c args' runs command in a process, output goes to stdout and -- stderr cmd_ :: String -> [String] -> IO () -- | 'cmdBool c args' runs a command, and return Boolean status cmdBool :: String -> [String] -> IO Bool -- | 'cmdIgnoreErr c args inp' runs a command with input, drops stderr, and -- return stdout cmdIgnoreErr :: String -> [String] -> String -> IO String -- | 'cmdLines c args' runs a command, and returns list of stdout lines cmdLines :: String -> [String] -> IO [String] -- | 'cmdMaybe c args' runs a command, maybe returning output if it -- succeeds cmdMaybe :: String -> [String] -> IO (Maybe String) -- | 'cmdLog c args' logs a command with a datestamp cmdLog :: String -> [String] -> IO () -- | cmdlog deprecated alias for cmdLog (will be removed in -- 0.3) cmdlog :: String -> [String] -> IO () -- | 'cmdN c args' dry-runs a command: prints command to stdout - more used -- for debugging cmdN :: String -> [String] -> IO () -- | 'cmdQuiet c args' runs a command hiding stderr, if it succeeds returns -- stdout cmdQuiet :: String -> [String] -> IO String -- | 'cmdSilent c args' runs a command hiding stdout: stderr is only output -- if it fails. cmdSilent :: String -> [String] -> IO () -- | 'cmdStdIn c args inp' runs a command, passing input string as stdin, -- and returns stdout cmdStdIn :: String -> [String] -> String -> IO String -- | 'cmdStdErr c args' runs command in a process, returning stdout and -- stderr cmdStdErr :: String -> [String] -> IO (String, String) -- | Alias for errorWithoutStackTrace (for base >= 4.9) error' :: String -> a -- | 'egrep_ pat file' greps extended regexp in file, and returns Boolean -- status egrep_ :: String -> FilePath -> IO Bool -- | 'grep pat file' greps pattern in file, and returns list of matches grep :: String -> FilePath -> IO [String] -- | 'grep_ pat file' greps pattern in file and returns Boolean status grep_ :: String -> FilePath -> IO Bool -- | 'logMsg msg' outputs message with a timestamp logMsg :: String -> IO () -- | 'removePrefix prefix original' removes prefix from string if present removePrefix :: String -> String -> String -- | 'removeStrictPrefix prefix original' removes prefix, or fails with -- error' removeStrictPrefix :: String -> String -> String -- | 'removeSuffix suffix original' removes suffix from string if present removeSuffix :: String -> String -> String -- | 'shell cs' runs a command string in a shell, and returns stdout shell :: String -> IO String -- | 'shell_ cs' runs a command string in a shell, output goes to stdout shell_ :: String -> IO () -- | 'shellBool cs' runs a command string in a shell, output goes to stdout shellBool :: String -> IO Bool -- | 'sudo c args' runs a command as sudo returning stdout -- -- Result type changed from IO () to IO String in 0.2.0 sudo :: String -> [String] -> IO String -- | 'sudo_ c args' runs a command as sudo sudo_ :: String -> [String] -> IO () -- | warning outputs to stderr warning :: String -> IO () type PipeCommand = (String, [String]) -- | Return stdout from piping the output of one process to another pipe :: PipeCommand -> PipeCommand -> IO String -- | Pipe two commands without returning anything pipe_ :: PipeCommand -> PipeCommand -> IO () -- | Bool result of piping of commands pipeBool :: PipeCommand -> PipeCommand -> IO Bool -- | Pipe 3 commands, no returning anything pipe3_ :: PipeCommand -> PipeCommand -> PipeCommand -> IO () -- | Pipe a file to the first of a pipe of commands pipeFile_ :: FilePath -> PipeCommand -> PipeCommand -> IO () -- | Combine two strings with a single space (+-+) :: String -> String -> String infixr 4 +-+ -- | Some wrappers for git commands. module SimpleCmd.Git -- | 'git c args' runs git command and return output git :: String -> [String] -> IO String -- | 'git_ c args' run git command with output to stdout and stderr git_ :: String -> [String] -> IO () -- | gitBranch returns the git branch of the current directory gitBranch :: IO String -- | gitDiffQuiet checks if unchanged gitDiffQuiet :: [String] -> IO Bool -- | 'grepGitConfig pat' greps ".git/config" for extended regexp grepGitConfig :: String -> IO Bool -- | 'isGitDir dir' checks if directory has a .git/ subdir isGitDir :: FilePath -> IO Bool -- | rwGitDir checks if a git repo is under ssh rwGitDir :: IO Bool -- | This Rpm module currently only provides rpmspec. module SimpleCmd.Rpm -- | 'rpmspec args maybe-queryformat specfile' runs rpmspec query on file -- with optional args (a newline is appended to any queryformat) rpmspec :: [String] -> Maybe String -> FilePath -> IO [String]