Skip to content

Cobenian/elixir-cli-tool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

elixir-cli-tool

CLI tool for calling elixir functions

Installation

Prerequisites

You must have Elixir installed.

Install

Put the el file in your $PATH and make sure that it is executable.

>> chmod +x el
>> cp el /usr/local/bin/el

Usage

Use the @ symbol to indicate where you would like the text from stdin to be passed in your code.

Read all lines from stdin

Call el with no flags and it will read all the lines from stdin and pass them to your code as a list of strings.

Example:

A more verbose verison of wc -l

cat some_file.txt | el "Enum.count(@)"

Drops the header row from the output...

df -h | el "Enum.drop(@, 1)"

Read one line at a time

Call el with the -l flag and it will read one line at a time and evaluate the code for the given line.

Example:

cat some_file.txt | el -l "String.upcase(@)"

Pipelines

Note that you can combine commands via pipes AND use Elixir's pipe operator.

df -h | el "Enum.drop(@, 1)" | el -l "String.upcase(@)" | el -l "String.split(@) |> Enum.at(3)"

About

CLI tool for calling elixir functions

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages