shellmet

Out of the shell solution for scripting in Haskell

https://github.com/kowainik/shellmet

Version on this page:0.0.4.1
LTS Haskell 22.37:0.0.4.1@rev:1
Stackage Nightly 2023-12-26:0.0.4.1@rev:1
Latest on Hackage:0.0.4.1@rev:1

See all snapshots shellmet appears in

MPL-2.0 licensed by Dmitrii Kovanikov
Maintained by Kowainik
This version can be pinned in stack with:shellmet-0.0.4.1@sha256:6d1dd3ce296b00a589e439d20a4466515cdf3e6156a0a147156804ee544ee9d1,3239

Module documentation for 0.0.4.1

Used by 1 package in lts-20.11(full list with versions):

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

Changes

Changelog

shellmet uses PVP Versioning. The changelog is available on GitHub.

0.0.4.1 — Jun 13, 2022

  • #28: Support GHC 9.2.

0.0.4.0 — Mar 23, 2021

  • #20: Add isSuccess function to show if the command succeded.
  • #25: Support GHC-9.0.
  • Upgrade GHC from 8.8.3 to 8.8.4, 8.10.1 to 8.10.4.

0.0.3.1 — May 7, 2020

  • #18: Support GHC-8.10. Move from GHC-8.8.1 support to GHC-8.8.3.

0.0.3.0 — Sep 28, 2019

0.0.2.0 — Jul 4, 2019

  • #8: Implement $^ operator that doesn’t print the command to terminal.

0.0.1 — Apr 9, 2019

  • Generalise the type of the $? operator to allow returning values on shell-command failuires.

0.0.0

  • Initially created.