-- 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,
--   shake, etc.
@package simple-cmd
@version 0.2.7


-- | Some simple String wrappers of <a>readProcess</a>,
--   <a>readProcessWithExitCode</a>, <a>rawSystem</a> from the Haskell
--   <a>process</a> library.
--   
--   Simplest is
--   
--   <pre>
--   cmd_ :: String -&gt; [String] -&gt; IO ()
--   </pre>
--   
--   which outputs to stdout. For example:
--   
--   <pre>
--   cmd_ "git" ["clone", url]
--   </pre>
--   
--   Then
--   
--   <pre>
--   cmd :: String -&gt; [String] -&gt; IO String
--   </pre>
--   
--   returns stdout as a <tt>String</tt>.
--   
--   There are also <tt>cmdBool</tt>, <tt>cmdMaybe</tt>, <tt>cmdLines</tt>,
--   <tt>shell</tt>, and others.
--   
--   Other examples:
--   
--   <pre>
--   grep_ pat file :: IO Bool
--   </pre>
--   
--   <pre>
--   sudo c args :: IO ()
--   </pre>
module SimpleCmd

-- | <tt>cmd c args</tt> runs a command in a process and returns stdout
cmd :: String -> [String] -> IO String

-- | <tt>cmd_ c args</tt> runs command in a process, output goes to stdout
--   and stderr
cmd_ :: String -> [String] -> IO ()

-- | <tt>cmdBool c args</tt> runs a command, and return Boolean status
cmdBool :: String -> [String] -> IO Bool

-- | <tt>cmdIgnoreErr c args inp</tt> runs a command with input, drops
--   stderr, and return stdout
cmdIgnoreErr :: String -> [String] -> String -> IO String

-- | <tt>cmdLines c args</tt> runs a command, and returns list of stdout
--   lines
cmdLines :: String -> [String] -> IO [String]

-- | <tt>cmdMaybe c args</tt> runs a command, maybe returning output if it
--   succeeds
cmdMaybe :: String -> [String] -> IO (Maybe String)

-- | <tt>cmdFull c args inp</tt> 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)

-- | <tt>cmdLog_ c args</tt> logs a command with a datestamp
cmdLog_ :: String -> [String] -> IO ()

-- | deprecated, use <tt>cmdLog_</tt> instead (will change type in 0.3)
cmdLog :: String -> [String] -> IO ()

-- | <tt>cmdlog</tt> deprecated alias for <a>cmdLog_</a> (will be removed
--   in 0.3)
cmdlog :: String -> [String] -> IO ()

-- | <tt>cmdN c args</tt> dry-runs a command: prints command to stdout -
--   more used for debugging
cmdN :: String -> [String] -> IO ()

-- | <tt>cmdQuiet c args</tt> runs a command hiding stderr, if it succeeds
--   returns stdout
cmdQuiet :: String -> [String] -> IO String

-- | <tt>cmdSilent c args</tt> runs a command hiding stdout: stderr is only
--   output if it fails.
cmdSilent :: String -> [String] -> IO ()

-- | <tt>cmdStdIn c args inp</tt> runs a command, passing input string as
--   stdin, and returns stdout
cmdStdIn :: String -> [String] -> String -> IO String

-- | <tt>cmdStdErr c args</tt> runs command in a process, returning stdout
--   and stderr
cmdStdErr :: String -> [String] -> IO (String, String)

-- | <tt>cmdTry_ c args</tt> 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
--   
--   <pre>
--   needProgram progname
--   </pre>
needProgram :: String -> IO ()

-- | Alias for errorWithoutStackTrace (for base &gt;= 4.9)
error' :: String -> a

-- | <tt>warning</tt> outputs to stderr
warning :: String -> IO ()

-- | output a newline
newline :: IO ()

-- | <tt>logMsg msg</tt> outputs message with a timestamp
logMsg :: String -> IO ()

-- | Combine two strings with a single space
(+-+) :: String -> String -> String
infixr 4 +-+

-- | <tt>removePrefix prefix original</tt> removes prefix from string if
--   present
removePrefix :: String -> String -> String

-- | <tt>removeStrictPrefix prefix original</tt> removes prefix, or fails
--   with error'
removeStrictPrefix :: String -> String -> String

-- | <tt>removeSuffix suffix original</tt> removes suffix from string if
--   present
removeSuffix :: String -> String -> String

-- | <tt>egrep_ pat file</tt> greps extended regexp in file, and returns
--   Boolean status
egrep_ :: String -> FilePath -> IO Bool

-- | <tt>grep pat file</tt> 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]

-- | <tt>grep_ pat file</tt> greps pattern in file and returns Boolean
--   status
grep_ :: String -> FilePath -> IO Bool

-- | <tt>shell cs</tt> runs a command string in a shell, and returns stdout
shell :: String -> IO String

-- | <tt>shell_ cs</tt> runs a command string in a shell, output goes to
--   stdout
shell_ :: String -> IO ()

-- | <tt>shellBool cs</tt> runs a command string in a shell, output goes to
--   stdout
shellBool :: String -> IO Bool

-- | <tt>sudo c args</tt> runs a command as sudo returning stdout
--   
--   Result type changed from IO () to IO String in 0.2.0
sudo :: String -> [String] -> IO String

-- | <tt>sudo_ c args</tt> runs a command as sudo
--   
--   @since 0.2.7 no longer logs (use sudoLog)
sudo_ :: String -> [String] -> IO ()

-- | <tt>sudo_ c args</tt> runs a command as sudo
sudoLog :: String -> [String] -> IO ()

-- | <tt>sudoInternal</tt> converts a command runner to sudo
--   
--   Uses sudo unless the effective uid is 0, otherwise errors if sudo not
--   found.
sudoInternal :: (String -> [String] -> IO a) -> String -> [String] -> IO a

-- | 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 ()
ifM :: Monad m => m Bool -> m a -> m a -> m a
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)

-- | Run an IO action and then print how long it took
timeIO :: IO a -> IO a


-- | Some wrappers for git commands.
module SimpleCmd.Git

-- | <tt>git c args</tt> runs git command and return output
git :: String -> [String] -> IO String

-- | <tt>git_ c args</tt> run git command with output to stdout and stderr
git_ :: String -> [String] -> IO ()

-- | <tt>gitBool c args</tt> runs git command and return result
gitBool :: String -> [String] -> IO Bool

-- | <tt>gitBranch</tt> returns the git branch of the current directory
gitBranch :: IO String

-- | <tt>gitDiffQuiet</tt> checks if unchanged
gitDiffQuiet :: [String] -> IO Bool

-- | <tt>grepGitConfig pat</tt> greps ".git/config" for extended regexp
grepGitConfig :: String -> IO Bool

-- | <tt>isGitDir dir</tt> checks if directory has a .git/ subdir
isGitDir :: FilePath -> IO Bool

-- | <tt>rwGitDir</tt> checks if a git repo is under ssh
rwGitDir :: IO Bool


-- | This Rpm module currently only provides <tt>rpmspec</tt>.
module SimpleCmd.Rpm

-- | <tt>rpmspec args mqueryformat specfile</tt> runs rpmspec query on file
--   with optional args (a newline is appended to any queryformat)
rpmspec :: [String] -> Maybe String -> FilePath -> IO [String]
