fireproofsocks

fireproofsocks

Refresh screen while awaiting/consuming CLI input

I have been exploring concurrency and state while working on a text adventure game and one of the tricky things is how to refresh the screen when something happens. When an app is awaiting user input via
Mix.Shell.IO.prompt/1, is there any way to refresh/redraw the screen? For example, when something happens in the game, I would need to notify the user, and ideally I would want to do this BEFORE they input their next command and press enter.

I hope that makes sense. I’m scratching my head a bit when there is probably a simple solution. Thanks for any tips!

Marked As Solved

hauleth

hauleth

There is no way in Mix or in general in Erlang, at least not built in. You will need to switch terminal to raw input mode and then you can control all text that is visible in the terminal emulator.

Also Liked

stefanchrobot

stefanchrobot

Have a look at ex_termbox.

Last Post!

fireproofsocks

fireproofsocks

Thank you!

Where Next?

Popular in Questions Top

Qqwy
Original source of discussion: This topic on the Pragmatic Programmers’ Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
Lily
In templates/appointment/index.html.eex: <%= for appointment <- @appointments do %> <tr> <td><%= appoi...
New
Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New

Other popular topics Top

Qqwy
Update: How to use the Blogs & Podcasts section You can post links to your blog posts or podcasts either in one of the Official Blog...
3271 130579 1222
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
AstonJ
Seen any cool LiveView demos, sample apps or examples? Please post them here! :003:
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New

We're in Beta

About us Mission Statement