simple-cmd: Simple String-based process commands

[ bsd3, library, system ] [ Propose Tags ]

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.


[Skip to Readme]
Versions [faq] 0.1.0.0, 0.1.1, 0.1.2, 0.1.3, 0.1.3.1, 0.1.4, 0.2.0, 0.2.0.1
Change log ChangeLog.md
Dependencies base (<5), directory, filepath, process (>=1.4.3.0), unix [details]
License BSD-3-Clause
Copyright Jens Petersen <juhpetersen@gmail.com>
Author Jens Petersen
Maintainer juhpetersen@gmail.com
Category System
Source repo head: git clone https://github.com/juhp/simple-cmd
Uploaded by JensPetersen at Tue Jun 4 03:31:21 UTC 2019
Distributions Fedora:0.1.3.1, LTSHaskell:0.1.4, NixOS:0.2.0.1, Stackage:0.2.0.1
Downloads 996 total (83 in the last 30 days)
Rating (no votes yet) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs available [build log]
Last success reported on 2019-06-04 [all 1 reports]

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees


Readme for simple-cmd-0.2.0.1

[back to package description]

Build Status Hackage

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"])

Other examples:

gitBranch :: IO String
grep_ pat file :: IO Bool
sudo_ c args :: IO ()

See the library documentation for more details.