🐚 Out of the shell solution for scripting in Haskell
Go to file
Arya Irani 782d5f44b9
avoid callCommand . showCommandForUser (#27)
* avoid callCommand + showCommandForUser

* remove redundant import from README.md
2022-04-01 13:22:38 +01:00
.github [#25] Support GHC-9.0 (#26) 2021-03-23 12:45:07 +00:00
src avoid callCommand . showCommandForUser (#27) 2022-04-01 13:22:38 +01:00
test [#18] Support GHC-8.10 (#19) 2020-05-07 18:11:49 +01: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
CHANGELOG.md Update copyright years 2021-03-23 14:50:39 +00: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 avoid callCommand . showCommandForUser (#27) 2022-04-01 13:22:38 +01:00
shellmet.cabal Update copyright years 2021-03-23 14:50:39 +00:00
stack.yaml [#25] Support GHC-9.0 (#26) 2021-03-23 12:45:07 +00:00

shellmet

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