Skip to content

Elixir library for converting shell commands into line-based strings

License

Notifications You must be signed in to change notification settings

aleandros/shell_stream

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ShellStream

Build Status

ShellStream is a small library that exposes a single function (and sigil) for running shell commands and returning a stream which generates an element for every line of the command output.

Usage

If you do not need the sigil, simply run:

ShellStream.shell("seq 10") |> Stream.map(&String.to_integer/1) |> Enum.to_list
# [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

The sigil syntax simply wraps the shell function. Only the extra import is required.

import ShellStream
~x(seq 10) |> Stream.map(&String.to_integer/1) |> Enum.to_list
# [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

Installation

  1. Add shell_stream to your list of dependencies in mix.exs:

    def deps do [{:shell_stream, "~> 0.0.1"}] end

  2. Ensure shell_stream is started before your application:

    def application do [applications: [:shell_stream]] end

About

Elixir library for converting shell commands into line-based strings

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages