Removed Interactive Editing
You may wonder why I removed it after more than 5 hours of coding. Here’s why.
I wanted to achieve something like this:
Ruleset
> Name: rule-foo-bar
Authors: Alice
Description: This is a placeholder description.
Version: 1
Edit Rules
← Back
I tried inquire and Ratatui to implement this. However, both of them was not suitable for this after all.
inquire
inquire is a very simple crate to ask users some question on CLI.
The main problem was that I could not add multiple fields and let user edit multiple fields in the same screen (like above), which means that the implementation had to be like this:
Select what to edit
> Name
Authors
Description
Version
Back
and I wanted to avoid this.
Ratatui
Ratatui is a crate to build a “TUI” application in Rust.
It is very powerful, but I found it a bit over-engineered for my use case. Also, it is mainly designed for full-screen terminal application and was not suitable for inline CLI application like mine.
Making a CLI Library Myself
I also tried to make a CLI library myself, but I decided not to do so. (You can find my library repository here.)
I used crossterm and I had to calculate the position of the cursor, characters and I also had to count unicode characters and calculate the widths for them. I thought that this was not worth it, especially because I didn’t have so much time before the summer break ends.
For now, I decided to make edit command just open the default editor and implement other things, and make the CLI after adding all other essential features.
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.