Use GNU Readline for the metacall-cli shell
Closed this issue · 3 comments
Hello,
Current CLI shell doesn't support basic features like history, line editing, completion, etc. It can be easily achieved using the GNU Readline library.
I have attached to this issue an example of a tiny shell using it. Please, consider this as just an example, since it can contain memory leaks and vulnerabilities (e.g., user input is not properly checked).
Thank you.
Hello @viferga, is this issue still relevant, I saw the discussion on #84, it seems the plan is to replace it with a python/node CLI parser, if this is still relevant, I would like to work on the issue. Also for the purpose of the https://github.com/metacall/gsoc-2021#cli-security-through-seccomp-sandboxing project, this will be required, I think so.
Also, I would like to remind you that readline is not available for Windows, so we may want to see some alternatives or implement them for Windows ourselves.
Hi @avinal, sorry for the late reply. Right now this issue can be archived because this will be replaced by this task: #84
Finally we have decided to implement the REPL using Python, and maintain the current available functions written in C/C++, populating them to the REPL library in Python (giving them the proper command information and treating them as built-ins).
Apart from this, the CLI issue will add extensibility to the CLI, so other plugins can be implemented easily like for example the sandboxing support you mentioned by means of a Python plugin too:
https://github.com/seccomp/libseccomp/blob/main/src/python/setup.py
https://pypi.org/project/pyseccomp/
I think this is the right path to go because we can remove as much as functionality we can from the CLI in C/C++ and let this work for the plugin implementators, which can be done in multiple different programming languages.