runlet v1.0.0 Runlet.CLI
Compile runlet expresions
Link to this section Summary
Functions
Add a runlet expression to the end of a pipeline.
Compile a runlet expression into Elixr AST
Compile a runlet expression into the AST
Compile a runlet expression into the AST
Compile a runlet expression into Elixr AST
Insert a runlet pipeline into another pipeline.
Parse a runlet expression.
Add a runlet expression at the start of a pipeline.
Link to this section Types
Link to this section Functions
Add a runlet expression to the end of a pipeline.
Examples
iex> Runlet.CLI.append(~s(test "foo" | bar 123 | another), ~s(insert | here)) {:ok, [{"test", ["foo"]}, {"bar", '{'}, {"another", []}, {"insert", []},
{"here", []}]}
ast(pipeline, commands)
Compile a runlet expression into Elixr AST
Commands are looked up in the application environment:
Application.get_env(:runlet, :aliases, [])
compile(pipeline, commands)
Compile a runlet expression into the AST
Examples
iex> Runlet.CLI.compile( ...> ~s(test "foo" | bar 123), ...> [{"test", [{[:Fake, :Cmd, :AddArg], :exec}, ...> {{:Fake, :Cmd, :StaticArg}, ["static arg"]}]}, ...> {"bar", {[:Fake, :Cmd, :IntArg], :exec}}]) {:ok, {:|>, [context: Elixir, import: Kernel],
[{:|>, [context: Elixir, import: Kernel],
[{{:., [], [{:__aliases__, [alias: false], [:Fake, :Cmd, :AddArg]}, :exec]},
[], ["foo"]},
{{:., [],
[{:__aliases__, [alias: false], {:Fake, :Cmd, :StaticArg}},
["static arg"]]}, [], ["foo"]}]},
{{:., [], [{:__aliases__, [alias: false], [:Fake, :Cmd, :IntArg]}, :exec]},
[], '{'}]}}
Compile a runlet expression into the AST
Commands are looked up in the application environment:
Application.get_env(:runlet, :aliases, [])
Compile a runlet expression into Elixr AST
Examples
iex> Runlet.CLI.compile!( ...> ~s(test "foo" | bar 123), ...> [{"test", [{[:Fake, :Cmd, :AddArg], :exec}, ...> {{:Fake, :Cmd, :StaticArg}, ["static arg"]}]}, ...> {"bar", {[:Fake, :Cmd, :IntArg], :exec}}]) {:|>, [context: Elixir, import: Kernel], [{:|>, [context: Elixir, import: Kernel],
[{{:., [], [{:__aliases__, [alias: false], [:Fake, :Cmd, :AddArg]}, :exec]},
[], ["foo"]},
{{:., [],
[{:__aliases__, [alias: false], {:Fake, :Cmd, :StaticArg}},
["static arg"]]}, [], ["foo"]}]},
{{:., [], [{:__aliases__, [alias: false], [:Fake, :Cmd, :IntArg]}, :exec]},
[], '{'}]}
exec(ast)
exec(ast, bind)
exec!(ast)
exec!(ast, bind)
expand(pipeline, fun)
insert(pipeline, command, position)
Insert a runlet pipeline into another pipeline.
Examples
iex> Runlet.CLI.insert(~s(test "foo" | bar 123 | another), ...> ~s(insert | here), 2) {:ok, [{"test", ["foo"]}, {"bar", '{'}, {"insert", []}, {"here", []},
{"another", []}]}
lex(command)
parse(command)
Parse a runlet expression.
Examples
iex(7)> Runlet.CLI.parse(~s(test "foo" | bar 123 | out > 456)) {:ok, [{"test", ["foo"]}, {"bar", '{'}, {"out", []}, {">", [456]}]}
pipe(code)
prepend(code, command)
Add a runlet expression at the start of a pipeline.
Examples
iex> Runlet.CLI.prepend(~s(test "foo" | bar 123 | another), ~s(insert | here)) {:ok, [{"insert", []}, {"here", []}, {"test", ["foo"]}, {"bar", '{'},
{"another", []}]}