提供处理 Ringo shell / REPL 的功能。它允许以编程方式启动新的 Ringo shell。每个 Ringo REPL 都在内部使用该模块与用户进行交互。该示例显示了一个简单的 Ringo shell 脚本,它准备一个对象并打开一个实时交互的 shell。
#!/usr/bin/env ringo
if (require.main == module) {
var obj = { 'foo': 'bar' };
require('ringo/shell').start();
}
// running the script opens a new shell
// with the prepared object available
>> console.log(obj);
{ foo: 'bar' }
退出 shell 并退出 JVM。
Number | status | optional integer exit status code (default is 0) |
从标准输入中读取单个字符。
从标准输入中读取一行。
String | prompt | optional prompt to display |
String | echoChar | character to use as echo, e.g. '*' for passwords or '' for no echo. |
以编程方式启动 shell。这使用当前线程,因此不会返回。因此,您应该将此函数作为脚本中的最后一个语句。终止 shell 将退出程序。
RhinoEngine | engine |