Would it be possible to implement getch using Owl.LiveScreen (or some other method)?
I don’t think so. At least for now, I don’t see a way how to implement this easily.
Ruby has TTY Toolkit . Do you envision Owl to provide similar features?
Some components can be definitely useful and easily ported. Didn’t know about this project, thank you. I saw GitHub - Shopify/cli-ui: Terminal user interface library and wanted to make something better There is another similar project in JS ecosystem inquirer - npm. Owl doesn’t support getting char as you type, so whistles and bells like in inquirer are not possible.
I don’t understand what use-cases are addressed by the Erlang I/O protocol and Owl.LiveScreen. Can you talk a bit about that
Sure. Logger writes to stdout by default, and when you draw N progress bars, the cursor has to be moved N lines up, and replace these lines with the new content. It is okay if progress bars are rendered there, but if not, then the content will be replaced. It means that Logger has to be synchronized with an engine that is used for drawing bars. This can be achieved by simply using this line:
That’s it. Now when you log something, messages will be rendered ABOVE progress bars or any other dynamic blocks. There is an example with Logger here owl/emulate_compilation.exs at 9390b8f020aa6ef146c0a51af21bef5be911599b · fuelen/owl · GitHub
Let’s say you render progress bars and want to inspect my_variable using IO.inspect. Everything will be messed up if you simply type IO.inspect(my_variable). Because Owl.LiveScreen implements Erlang I/O protocol, my_variable can be easily inspected by IO.inspect(Owl.LiveScreen, my_variable, )
What types of apps would be a good fit for Owl vs ExNcurses?
The biggest change in this release is an ability to render tables.
Tables are highly customizable, they work with Owl.Data.t() which allows colorizing even different chars inside a cell, not just a whole cell like in other libraries. Input expects a list of maps, and this structure allows autodetection of columns. There is sorting and filtering of columns, ability to specify max width for entire table (I wanted this for iex helpers ) and for individual columns. And other minor but nice things
A question about LiveScreen – is it possible to capture input/confirmation in a LiveScreen block while allowing other various printed messages to continue above? E.g. imagine the dependency compilation demo, but it prompts the user y/n to compile the dependencies one after the other and then shows the individual file compilation above asynchronously.
I’m thinking no, a least not at the moment, since the LiveScreen render has to return Owl.Data.t() and there doesn’t appear to be any way to “direct” an Owl.IO.confirm/etc. to something other than :stdio.
No, it is not possible to type anything and produce output at the same time. We need better control over inputs, and here is a problem. There is a related discussion here Portable getch? · Discussion #5 · fuelen/owl · GitHub
The easiest workaround for now is to handle editing in the editor.