🐚 Out of the shell solution for scripting in Haskell
Go to file
Dmitrii Kovanikov 7f7542c0f8 [#13] Build with GHC-8.8 (#14)
Resolves #13
2019-08-29 08:51:16 +04: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 Create the project 2019-02-23 21:02:45 +08:00
.stylish-haskell.yaml Create the project 2019-02-23 21:02:45 +08:00
.travis.yml [#13] Build with GHC-8.8 (#14) 2019-08-29 08:51:16 +04:00
CHANGELOG.md [#13] Build with GHC-8.8 (#14) 2019-08-29 08:51:16 +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 [#13] Build with GHC-8.8 (#14) 2019-08-29 08:51:16 +04:00
shellmet.cabal [#13] Build with GHC-8.8 (#14) 2019-08-29 08:51:16 +04:00
stack.yaml [#13] Build with GHC-8.8 (#14) 2019-08-29 08:51:16 +04:00

shellmet

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 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