https://github.com/nh2/command
Conveniently run shell commands in Haskell (extracted from the Shake build system)
https://github.com/nh2/command
Last synced: 8 months ago
JSON representation
Conveniently run shell commands in Haskell (extracted from the Shake build system)
- Host: GitHub
- URL: https://github.com/nh2/command
- Owner: nh2
- Created: 2013-10-28T20:44:18.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2014-09-02T16:58:30.000Z (over 11 years ago)
- Last Synced: 2024-04-13T22:09:25.946Z (over 1 year ago)
- Language: Haskell
- Size: 148 KB
- Stars: 6
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
command
=======
This is a standalone version of the powerful and intuitive command line functions present in the [Shake](http://hackage.haskell.org/package/shake) build system (so that they work in plain `IO`).
They are intended as an easy-to-remember, easy-to-use alternative to the [System.Process](hackage.haskell.org/package/process/docs/System-Process.html) functions.
Examples
--------
The function with most convenience is `cmd`.
```haskell
cmd "gcc -c myfile.c" -- compile a file, throwing an exception on failure
```
`cmd` understands what you want to do using type inference.
```haskell
Stdout out <- cmd "gcc -MM myfile.c" -- run a command, recording the output
Exit c <- cmd "gcc -c" [myfile] -- run a command, recording the exit code
(Exit c, Stderr err) <- cmd "gcc -c myfile.c" -- run a command, recording the exit code and error output
cmd (Cwd "generated") "gcc -c" [myfile] :: Action () -- run a command in a directory
```
Credit
------
All credit goes to the [Shake](http://hackage.haskell.org/package/shake) author!
I hope he'll take it over as a standalone project.