-
Notifications
You must be signed in to change notification settings - Fork 37
Description
Terminal Applications
Applications such as Python, MongoDB, and PostgreSQL come with an interactive terminal interface that allows real-time processing of commands one after another. Since these shell interfaces are so common and useful, it would be useful to add a generic one to the library.
Generic Terminal
The result would be a terminal function that takes argc and argv from main and passes them off to a user-defined interpreter. Since the command syntax and resulting actions are unknown to the generic function, the purpose of the function is to switch between two activation conditions:
- Launching with no arguments:
> $ ./application
This should open an interactive shell where the user may enter repeated commands to pass to the interpreter.
- Launching with arguments:
> $ ./application arg1 arg2
This should simply pass the two arguments to the interpreter and close.
Data Pipes
While designing a terminal application, it is important to remember that commands may come from data pipes rather than direct user input. A robust implementation of an interactive terminal should be capable of receiving input through a pipe rather than user input.