I've written a small console application that can perform certain tasks. The user interface is similar to things like version control systems or yum etc. So basically you can think of it as a domain specific language. Now I'd like to write a (bash like) shell that can execute and auto-complete this language and has a command history (so I do not have to load and save the quite large xml files on each command). In a nutshell I want something like ipython but not for executing python code but my own DSL.
Are there any libraries that help me doing this? I see that there is a readline and rlcompleter module in python but its documentation seems to indicate that this is only for use with the python shell itself, or did I miss something there?
To run the Python Shell, open the command prompt or power shell on Windows and terminal window on mac, write python and press enter. A Python Prompt comprising of three greater-than symbols >>> appears, as shown below. Now, you can enter a single statement and get the result.
Python allows you to execute shell commands, which you can use to start other programs or better manage shell scripts that you use for automation. Depending on our use case, we can use os. system() , subprocess.
The Python Shell is the interpreter that executes your Python programs, other pieces of Python code, or simple commands.
To start the Python shell, simply type python and hit Enter in the terminal: C:\Users\Suchandra Datta>python Python 3.8.
You should check out the cmd and cmd2 modules. I think they will do what you want. There was a PyCon talk about these.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With