About

Metadata

  • Last updated , by JensPetersen
  • License BSD-3-Clause
  • Categories Systems Programming
  • Maintained by: Jens Petersen <juhpetersen@gmail.com>

  • Lottery factor: 0

Links

Installation

Tested Compilers

  1. 9.2.3
  2. 9.0.2
  3. 8.10.7
  4. 8.8.4
  5. 8.6.5
  6. 8.4.4
  7. 8.2.2
  8. 8.0.2
  9. 7.10.3

Readme

Hackage Stackage LTS Stackage Nightly

simple-cmd

Some simple String wrappers of readProcess, readProcessWithExitCode, rawSystem from the Haskell process library.

Usage

import SimpleCmd
cmd_ :: String -> [String] -> IO ()

outputs to stdout. For example

cmd_ "echo" ["Hello"]
cmd_ "git" ["clone", url]

This can shortened to git_ "clone" [url].

cmd :: String -> [String] -> IO String

returns stdout as a String. eg

date <- cmd "date" []

There are also cmdBool, cmdMaybe, cmdList, shell, and others.

Simple pipes are also supported:

pipe_ ("echo",["hello"]) ("grep",["ello"])

pipeBool returns True if both commands succeed.

Other examples:

gitBranch :: IO String
grep_ pat file :: IO Bool
sudo_ c args :: IO ()
timeIO :: IO a -> IO a

See the library documentation for more details.