2018-07-06 11:13:38 +01:00
|
|
|
/**
|
2018-09-04 10:05:04 +01:00
|
|
|
* Create a REPL server for chef
|
|
|
|
*
|
2018-07-06 11:13:38 +01:00
|
|
|
*
|
2018-09-04 10:05:04 +01:00
|
|
|
* @author d98762656 [d98762625@gmail.com]
|
|
|
|
* @copyright Crown Copyright 2018
|
|
|
|
* @license Apache-2.0
|
2018-07-06 11:13:38 +01:00
|
|
|
*/
|
|
|
|
|
2022-03-28 10:52:28 +01:00
|
|
|
import chef from "./index.mjs";
|
|
|
|
import repl from "repl";
|
2019-07-19 13:14:32 +01:00
|
|
|
|
2018-07-06 11:13:38 +01:00
|
|
|
|
2019-11-14 08:55:27 +00:00
|
|
|
/* eslint no-console: ["off"] */
|
2018-07-06 11:13:38 +01:00
|
|
|
|
2018-09-21 12:24:34 +01:00
|
|
|
console.log(`
|
|
|
|
______ __ ________ ____
|
|
|
|
/ ____/_ __/ /_ ___ _____/ ____/ /_ ___ / __/
|
|
|
|
/ / / / / / __ \\/ _ \\/ ___/ / / __ \\/ _ \\/ /_
|
|
|
|
/ /___/ /_/ / /_/ / __/ / / /___/ / / / __/ __/
|
|
|
|
\\____/\\__, /_.___/\\___/_/ \\____/_/ /_/\\___/_/
|
|
|
|
/____/
|
|
|
|
|
|
|
|
`);
|
2018-07-06 11:13:38 +01:00
|
|
|
const replServer = repl.start({
|
2018-09-04 10:05:04 +01:00
|
|
|
prompt: "chef > ",
|
|
|
|
});
|
|
|
|
|
2019-07-19 13:14:32 +01:00
|
|
|
global.File = chef.File;
|
2019-02-15 15:20:05 +00:00
|
|
|
|
2018-10-05 18:24:06 +01:00
|
|
|
Object.keys(chef).forEach((key) => {
|
|
|
|
if (key !== "operations") {
|
|
|
|
replServer.context[key] = chef[key];
|
|
|
|
}
|
2018-07-06 11:13:38 +01:00
|
|
|
});
|
|
|
|
|