shellout
A Gleam wrapper for Elixir.System.cmd/3
Usage
import gleam/iterator
import shellout
try tuple(output, status) =
shellout.cmd("ls", ["-lah"], [StderrToStdout(True)])
output
|> iterator.from_list
|> iterator.map(with: fn(line) { io.print(line) })
|> iterator.run
status
As a dependency of your Mix project
Add shellout to mix.exs
:
{:shellout, "~> 0.1"},
Tooling improvements are in the works. For now the following commands should work.
From your project’s root dir:
$ mix deps.get
$ sh -c 'cd deps/shellout/ && mix deps.get && mix compile'
$ mix compile # or mix escript.build, etc
Test
$ mix eunit
Notice
shellout.{cmd}
is intended as a short-term solution. Users should
favor gleam_stdlib
’s gleam/os.{cmd}
(or its equivalent), once it exists.