I'm working on an interactive shell where the user is entering some text, and get text back in a way that looks like a conversation. On recent SMS UIs on androids and iphones, you can see text aligned to the left for the text you wrote, and text aligned to the right for the text you received.
This is the effect I want to achieve, but in a Linux shell (without fancy graphics, just the flow of inputs and outputs).
I'm well aware of the format()
and rjust()
methods but they require to know the number of characters your want to pad the value with, and I don't know the width of the current shell.
I'm not limited in the lib I can install or use and I'm mainly aiming the Linux platform, thought having something cross platform is always nice.