simple-cmd: Simple String-based process commands

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain] [Publish]

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.


[Skip to Readme]

Properties

Versions 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, 0.2.1, 0.2.2, 0.2.3, 0.2.4, 0.2.5, 0.2.6, 0.2.6, 0.2.7
Change log ChangeLog.md
Dependencies base (<5), directory (>=1.2.5.0), extra, filepath, process (>=1.4.3.0), time, unix [details]
License BSD-3-Clause
Copyright 2017-2022 Jens Petersen <juhpetersen@gmail.com>
Author Jens Petersen <juhpetersen@gmail.com>
Maintainer Jens Petersen <juhpetersen@gmail.com>
Category System
Home page https://github.com/juhp/simple-cmd
Bug tracker https://github.com/juhp/simple-cmd/issues
Source repo head: git clone https://github.com/juhp/simple-cmd
Uploaded by JensPetersen at 2022-05-18T16:46:49Z

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


Readme for simple-cmd-0.2.6

[back to package description]

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.