How to use repl - 10 common examples

To help you get started, we’ve selected a few repl examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github noobaa / noobaa-core / src / agent / agent_cli.js View on Github external
function agent_cli_repl() {
    // start a Read-Eval-Print-Loop
    var repl_srv = repl.start({
        prompt: 'agent-cli > ',
        useGlobal: false
    });
    repl_srv.context.list_agents = list_agents;
    repl_srv.context.list_hosts = list_hosts;
    repl_srv.context.stop_host = stop_host;
    repl_srv.context.start_host = start_host;
    repl_srv.context.start_agent = start_agent;
    repl_srv.context.stop_agent = stop_agent;
}
github kanaka / miniMAL / js / step1_read_print.js View on Github external
!function() {

function EVAL(ast, env) {
    return ast
}


// Node specific
require("repl").start({
    eval:     (...a) => a[3](0,EVAL(JSON.parse(a[0]),{})),
    writer:   JSON.stringify,
    terminal: 0})

}()
github persvr / pintura / template / start-node.js View on Github external
require("jsgi/cascade").Cascade([ 
	// cascade from static to pintura REST handling
		// the main place for static files accessible from the web
		require("jsgi/static").Static({urls:[""],roots:["public"]}),
		// this will provide access to the server side JS libraries from the client
		require("jsgi/transporter").Transporter({paths: [packagesRoot + "engines/browser/lib"].concat(require.paths.map(function(path){
        	return path.replace(/[\\\/]engines[\\\/](\w*)/,function(t, engine){
        		return "/engines/" + (engine === "default" ? "default" : "browser");
        	})
        }))}),
		// main pintura app		
		pintura.app
]));

// having a REPL is really helpful
require("repl").start();
github ptmt / flow-declarations / test / node / test-repl.js View on Github external
server_unix = net.createServer(function(socket) {
    assert.strictEqual(server_unix, socket.server);

    socket.on('end', function() {
      socket.end();
    });

    repl.start({
      prompt: prompt_unix,
      input: socket,
      output: socket,
      useGlobal: true
    }).context.message = message;
  });
github serialport / node-serialport / packages / repl / lib / index.js View on Github external
.then(portName => {
    console.log(`port = SerialPort("${portName}", { autoOpen: false })`)
    console.log('globals { SerialPort, portName, port }')
    const port = new SerialPort(portName, { autoOpen: false })
    const spRepl = repl.start({ prompt: '> ' })
    promirepl(spRepl)
    spRepl.context.SerialPort = SerialPort
    spRepl.context.portName = portName
    spRepl.context.port = port
  })
  .catch(e => {
github firmata / firmata.js / packages / firmata.js / repl.js View on Github external
const board = new firmata.Board(port, () => {
    console.log(`Successfully Connected to ${port}`);
    repl.start("firmata>").context.board = board;
  });
});
github voodootikigod / node-rolling-spider / eg / repl.js View on Github external
d.setup(function() {
      d.startPing();

      var replServer = repl.start({
        prompt: 'Drone (' + d.uuid + ') > '
      });

      replServer.context.drone = d;

      replServer.on('exit', function() {
        d.land();
        process.exit();
      });
    });
  });
github skale-me / skale / bin / shell.js View on Github external
#!/usr/bin/env node

const sc = require('../').context();
const ml = require('../ml');
const addAwait = require('await-outside').addAwaitOutsideToReplServer;
const repl = require('repl').start({ prompt: 'skale> ' });

addAwait(repl);
repl.context.sc = sc;
repl.context.ml = ml;
github deployd / deployd / lib / client / repl.js View on Github external
module.exports = function (dpd) {
	console.log('type help for a list of commands');
	var repl = require("repl")
	,	context = repl.start("dpd > ", null, replEval, true, true).context;
	server = dpd;

	context.dpd = buildReplClient(dpd);

	return commands;
};

repl

A simple fast template libray.

Unknown
Latest version published 13 years ago

Package Health Score

45 / 100
Full package analysis

Popular repl functions