🐚 Out of the shell solution for scripting in Haskell
Go to file
Dmitrii Kovanikov 94b76e1864 Use GitHub actions (#16)
* Use GitHub actions

* Fix workflows file
2019-12-27 16:54:41 +00:00
.github Use GitHub actions (#16) 2019-12-27 16:54:41 +00:00
src [#10] Add doctest (#11) 2019-07-30 18:32:16 +08:00
test [#13] Build with GHC-8.8 (#14) 2019-08-29 08:51:16 +04:00
.gitignore Prepare for the 0.0.3.0 release (#15) 2019-09-28 15:45:00 +04:00
.stylish-haskell.yaml Create the project 2019-02-23 21:02:45 +08:00
.travis.yml Use GitHub actions (#16) 2019-12-27 16:54:41 +00:00
CHANGELOG.md Prepare for the 0.0.3.0 release (#15) 2019-09-28 15:45:00 +04:00
CONTRIBUTING.md Create the project 2019-02-23 21:02:45 +08:00
LICENSE Create the project 2019-02-23 21:02:45 +08:00
README.lhs [#3] Write usage example in the README (#4) 2019-02-23 22:53:06 +08:00
README.md Use GitHub actions (#16) 2019-12-27 16:54:41 +00:00
shellmet.cabal Prepare for the 0.0.3.0 release (#15) 2019-09-28 15:45:00 +04:00
stack.yaml Prepare for the 0.0.3.0 release (#15) 2019-09-28 15:45:00 +04:00

shellmet

GitHub CI Build status Hackage Stackage Lts Stackage Nightly MPL-2.0 license

Out of the shell solution for scripting in Haskell. Shellmet provides an easy and convenient way to call shell commands from Haskell programs.

Usage example

This README contains the usage example of the shellmet library. The example is runnable. You can build and execute with the following command:

cabal run readme

Setting up

Since this tutorial is written using Literate Haskell, first, let's write all necessary pragmas and imports.

{-# LANGUAGE OverloadedStrings #-}

import Data.Semigroup ((<>))
import Shellmet (($|))

import qualified Data.Text as T

Simple scripting example

Below you can see how easy it is to interact with shell commands in Haskell:

main :: IO ()
main = do
    "echo" ["Starting shellmet readme..."]
    text <- "cat" $| ["README.md"]
    let cnt = T.pack $ show $ length $ T.lines text
    "echo" ["Number of lines in this README: " <> cnt]

And the output is:

⚙  echo 'Starting shellmet readme...'
Starting shellmet readme...
⚙  echo 'Number of lines in this README: 54'
Number of lines in this README: 54