Skip to content

DanRyba253/smh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

smh

A string manipulation tool written in haskell.


smh aims to bring the power of optics into the command line. It provides a terse, domain specific language for various string manipulation tasks.


Intalling

  • Arch linux

    yay -S smh-bin

  • With cabal

    cabal install smh

  • Any x86_64 linux

    Download the latest release

Building

Refer to the building instructions in the docs.

Examples of usage

  • smh 'words.if > len 3|get' < input_file - display all words longer than 3 characters
  • smh 'words.[0]|over upper' "hello world" - capitalize all words
  • smh 'lines.if startsWith "*".%words.[2]|get' < input_file - display the third word in lines that start with an asterisk
  • smh 'atKey "b"|over to %el.sum' '{"a": 1, "b": [1, 2, 3, 4, 5]}' - sum the values of a JSON array at the "b" key of a JSON object
  • '%(words.if isNumber)|get' < input_file - get all numbers in a file

Contributing

Before contributing, visit the Contributing page in the docs.

Acknowledgements

  • Haskell, for being an awesome language
  • lens library authors, for inspiring this whole ordeal
  • mkdocs team, for making an awesome static documentation site generator