2022-08-10 10:09:02 -05:00
|
|
|
export const hooks = {
|
|
|
|
/**
|
|
|
|
* Define REPL commands.
|
|
|
|
*
|
|
|
|
* Note: commands will be prefixed with a period in the Node REPL.
|
|
|
|
*/
|
|
|
|
'@flecks/repl.commands': () => ({
|
|
|
|
someCommand: (...args) => {
|
|
|
|
// args are passed from the Node REPL. So, you could invoke it like:
|
|
|
|
// .someCommand foo bar
|
|
|
|
// and `args` would be `['foo', 'bar']`.
|
2022-03-07 00:21:16 -06:00
|
|
|
},
|
2022-08-10 10:09:02 -05:00
|
|
|
}),
|
|
|
|
/**
|
|
|
|
* Provide global context to the REPL.
|
|
|
|
*/
|
|
|
|
'@flecks/repl.context': () => {
|
|
|
|
// Now you'd be able to do like:
|
|
|
|
// `node> someValue;`
|
|
|
|
// and the REPL would evaluate it to `'foobar'`.
|
|
|
|
return {
|
|
|
|
someValue: 'foobar',
|
|
|
|
};
|
2022-03-07 00:21:16 -06:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|