-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Passing -i or --interactive flag to socx will run socx in repl mode.
For a single command, there is no difference between normal and repl mode, both should act in the exact same way.
The difference between normal and repl modes is reflected after the invoked command returns from the call.
In normal mode, after the invoked command returns from the call, the process will eventually terminate (eventually since it may run custom exit handlers before the process termination but after the invoked command has returned)
In repl mode, the process will continue running forever after the command returns reading the next command from user input (stdin) until either a KeyboardInterrupt is raised (or any other signal is sent to the process who's signal disposition is to terminate the process), or the /exit command is read from user input
The repl implementation should conform to the following:
- Runs in an infinite loop, reading in the next user input line on each iteration to execute the next command
- The repl should have a custom command interface dedicated for repl commands that is invoked in the form of `/
- An input of ? or /help should print a the help menu of the current command and the available custom repl commands
- Terminating the repl with the /exit or by hitting Ctrl-C to raise a KeyboardInterrupt should result in normal termination of the repl process with an exit code of 0 - unless the repl is currently executing a command in a subprocess in which case a keyboard interrupt should only terminate the running subprocess without terminating the repl
- A command prefixed with the ! character should be ran in a standard tty with stdout and stderr piped so that output is streamed from the subprocess to the current repl session
- The /cd repl command should accept a path in the same manner as the standard cd command only that the path should represent a command group (that may be nested inside other groups which is why a path is needed) and change the default context (i.e. the current command group scope to which user input commands are sent by the repl session
- Specifying / as the argument to /cd should change the default context to the root
socxcommand group - Specifying .. as the argument to /cd should change the current command group context to the context of the group's parent command group, or do nothing if the current context is already the root
socxcontext (i.e. if the command group context does not have a parent command group)