Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/juhp/simple-cmd
Simple Haskell shell command process wrapper library
https://github.com/juhp/simple-cmd
Last synced: 8 days ago
JSON representation
Simple Haskell shell command process wrapper library
- Host: GitHub
- URL: https://github.com/juhp/simple-cmd
- Owner: juhp
- License: bsd-3-clause
- Created: 2017-04-14T10:33:01.000Z (over 7 years ago)
- Default Branch: main
- Last Pushed: 2022-09-17T08:50:24.000Z (about 2 years ago)
- Last Synced: 2024-04-25T23:31:19.089Z (7 months ago)
- Language: Haskell
- Size: 115 KB
- Stars: 4
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: ChangeLog.md
- License: LICENSE
Awesome Lists containing this project
README
[![Hackage](http://img.shields.io/hackage/v/simple-cmd.png)](http://hackage.haskell.org/package/simple-cmd)
[![Stackage LTS](http://stackage.org/package/simple-cmd/badge/lts)](http://stackage.org/lts/package/simple-cmd)
[![Stackage Nightly](http://stackage.org/package/simple-cmd/badge/nightly)](http://stackage.org/nightly/package/simple-cmd)# simple-cmd
Some simple String wrappers of `readProcess`, `readProcessWithExitCode`,
`rawSystem` from the Haskell `process` library.## Usage
```haskell
import SimpleCmd
``````haskell
cmd_ :: String -> [String] -> IO ()
```
outputs to stdout. For example```haskell
cmd_ "echo" ["Hello"]
cmd_ "git" ["clone", url]
```
This can shortened to `git_ "clone" [url]`.```haskell
cmd :: String -> [String] -> IO String
```
returns stdout as a `String`. eg```haskell
date <- cmd "date" []
```There are also `cmdBool`, `cmdMaybe`, `cmdList`, `shell`, and others.
Simple pipes are also supported:
```haskell
pipe_ ("echo",["hello"]) ("grep",["ello"])
```
`pipeBool` returns True if both commands succeed.Other examples:
```haskell
gitBranch :: IO String
grep_ pat file :: IO Bool
sudo_ c args :: IO ()
timeIO :: IO a -> IO a
```See the library documentation for more details.