flecks/packages/repl/build/dox/hooks.js

31 lines
723 B
JavaScript
Raw Normal View History

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