Creating a TUI like inquirer

Hi Rustaceans,

I'm pretty new to Rust and sometimes it takes a while for me to understand some concepts, but I love the language. I already created some small command line tools for internal uses.

I am now planning on creating something like survey or Inquirer.js. The reasons are:

  • I love programming
  • I love Rust
  • In order to get a deeper understanding of Rust, I want to take on a bigger project
  • I want to create something, which could also be used by others

It would also be my first "big" GitHub project. I tried to look at the source code of those two tools which I posted above, but the problem is that I really don't know how to start doing something like this in Rust.

Could you help me out and tell me what I might need or what to look for in order to create the graphics in the terminal and to allow the user to use the arrow keys in order to go up and down and choose and option?

Any tips or hints are much appreciated!

1 Like

Here's a small one done in Python:

You basically need to know what the ANSI/VT100 escape codes are

It's also important (under linux) to initialize the terminal using raw mode. By default the terminal is in canonical mode.


To create something a lot like survey, start with it

err := survey.Ask(qs, &answers)

into maybe

let Result(answers, error) = survey::ask(qs);

Define a minimal simple interface and then add features.

You don't need to start with more than standard input and output.
Maybe take a look at ncurses and likely other similar library's when wanting more advanced terminal control.


I think the ANSI escape codes will help me to create the functionality for the arrow keys. Thank you, and by the way, nice wood work!

@Munksgaard and I started last year, maybe you can take some parts of that for your project (or contribute to it directly)?

1 Like

Hey @killercup , this seems cool!

May I ask why you stopped developing it? Not enough time?

Yeah, my original use case (rustfix) works fine without this, so it's not blocking me and just a nice to have.

1 Like

Hi @Masblok,

I think @killercup and I ran into a few roadblocks, and I suddenly didn't have a lot of time for inquirer-rs, but it would be nice to get it back on track. If either of you want to contribute, I'd be happy to give you commit access :slight_smile:

1 Like


I will be happy to contribute. But since I am a Rust beginner, I want to contribute some code which is at least acceptable. I am going to read the Rust book again (its second edition) and then start contributing :slight_smile:

1 Like

That's great @Masblok. Shoot me a message if/when you have any questions :slight_smile:

1 Like