granyatee
Multiple elixir commands on iex -S mix
Is it possible that I execute two different commands when I use iex -S mix like you can do un unix bash using the && operator?
Edit:
i.e.: I want to reload a module and test one of the module’s functions something like
r App.CoursesModule && App.CoursesModule.list_courses()
Most Liked
benwilson512
The REPL executes elixir code, which generally means functions are called one per line. So you’d do:
iex(1)> IO.puts("hello world")
hello world
:ok
iex(2)> IO.puts("wazzup")
wazzup
:ok
You can put multiple commands on the same line and execute them unconditionally by separating them with a ;
iex(3)> IO.puts("hello world"); IO.puts("wazzup")
hello world
wazzup
:ok
You can use && to conditionally call functions as long as prior functions returned something “truthy”
iex(4)> true && IO.puts("wazzup")
wazzup
:ok
iex(5)> false && IO.puts("wazzup")
false
Basically it’s just Elixir code.
benwilson512
Hey @granyatee are you talking about running multiple mix tasks, or executing multiple commands inside the REPL that iex provides?
eksperimental
if you are talking the mix command, you can achieve that with mix do
for example:
mix do task1, task2, task3
Popular in Discussions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #hex









