My book Data Science at the Command Line has a chapter about this that scratches the surface and lists some resources in case you want to dive deeper [1]. I can also recommend checking out packages such as Rich [2] and Click [3], if only to get an idea of the possibilities when it comes to creating command-line tools with Python.
[1] https://datascienceatthecommandline.com/2e/chapter-4-creatin...
[2] https://github.com/Textualize/rich
[3] https://click.palletsprojects.com/en/8.1.x/