-- 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.4 -- | 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) -- | cmdFull c args inp runs readProcessWithExitCode and converts -- the ExitCode to Bool Removes the last newline from stdout and stderr -- (like the other functions) cmdFull :: String -> [String] -> String -> IO (Bool, String, 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) -- | cmdTry_ c args runs the command if available cmdTry_ :: String -> [String] -> IO () -- | Redirect stderr to stdout, ie with interleaved output cmdStderrToStdout :: String -> [String] -> IO (ExitCode, String) -- | Redirect stderr to stdout, ie with interleaved output cmdStderrToStdoutIn :: String -> [String] -> String -> IO (Bool, String) -- | Assert program in PATH -- --
-- needProgram progname --needProgram :: String -> IO () -- | Alias for errorWithoutStackTrace (for base >= 4.9) error' :: String -> a -- | warning outputs to stderr warning :: String -> IO () -- | logMsg msg outputs message with a timestamp logMsg :: String -> IO () -- | Combine two strings with a single space (+-+) :: String -> String -> String infixr 4 +-+ -- | 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 -- | 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 -- -- @since 0.1.2 (fixed not to error in 0.2.2) grep :: String -> FilePath -> IO [String] -- | grep_ pat file greps pattern in file and returns Boolean -- status grep_ :: String -> FilePath -> IO Bool -- | 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 () -- | Type alias for a command in a pipe 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 @since 0.2.0 Returns False if either -- command fails (since 0.2.4). pipeBool :: PipeCommand -> PipeCommand -> IO Bool -- | Pipe 3 commands, returning stdout pipe3 :: PipeCommand -> PipeCommand -> PipeCommand -> IO String -- | Pipe 3 commands, not returning anything pipe3_ :: PipeCommand -> PipeCommand -> PipeCommand -> IO () -- | Pipe a file to the first of a pipe of commands pipeFile_ :: FilePath -> PipeCommand -> PipeCommand -> IO () -- | Like if, but where the test can be monadic. ifM :: Monad m => m Bool -> m a -> m a -> m a -- | Like when, but where the test can be monadic. whenM :: Monad m => m Bool -> m () -> m () -- | returns the files with the give extension filesWithExtension :: FilePath -> String -> IO [FilePath] fileWithExtension :: FilePath -> String -> IO (Maybe FilePath) -- | 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 () -- | gitBool c args runs git command and return result gitBool :: String -> [String] -> IO Bool -- | 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 mqueryformat specfile runs rpmspec query on file -- with optional args (a newline is appended to any queryformat) rpmspec :: [String] -> Maybe String -> FilePath -> IO [String]