rich icon indicating copy to clipboard operation
rich copied to clipboard

Interactive CLI with tab-completion possible?

Open kusibornhauser opened this issue 3 years ago • 1 comments

Hi

I really love Rich ❤️. I want to create an interactive CLI application (I don't know if that's the correct term), much like a CLI on a Cisco network device or similar. The Python Cmd2 project is pretty much what I mean - but I want to use rich because it's really beautiful.

Is it possible to create such CLI applications with rich? So that I have a command prompt, and can use tab completion to complete known commands? If so are there examples I can check?

Many thanks!

kusibornhauser avatar Jul 19 '22 11:07 kusibornhauser

Rich doesn't do this. But you can use cmd2 to handle the prompt and write any output with Rich.

willmcgugan avatar Jul 21 '22 12:07 willmcgugan

@kusibornhauser: I'm one of the maintainers of https://github.com/python-cmd2/cmd2. We have an open issue to investigate how we might make cmd2 more friendly to use with rich. I've done some preliminary work on the rich branch of tomcatmanager to see what it would be like to have an application that used both cmd2 and rich. So far, all the basics work fine with no changes to cmd2 required.

If you have specific items you are interested in having better support/integration for beyond the tab completion you mentioned above, please feel free to join the discussion on https://github.com/python-cmd2/cmd2/issues/1251.

kotfu avatar Feb 01 '23 21:02 kotfu