MFDC REPL CLI
MFDC'sown internal REPL command line interface.
This project provides the executable
mreplwhich has the following functionality over regular REPL:
- Babel pre-compiler(
babelplugin) - All code is automatically compiled via BabelJSbefore it is run - making things like arrow functions available on older Node releases
lodashplugin) - lodash is provided as
momentplugin) - moment is provided as
- Mongoose project support(
mongooseplugin) - If the files
./models/index.jsare found they are loaded in that order (with
./models/index.jsexpected to return an object containing the available compiled schemas. Models are then provided in the
db.users.find()will return all users.
- STDIN slurping(
stdinplugin) - Any piped input into the program is provied as the
inputvariable. Automatic decoding of the variable will be attempted by
JSON.parse()otherwise it will be a raw string.
- History saving- History saing is enabled by default
Simply run the following:
sudo npm install -g @momsfriendlydevco/repl
You should now be able to run the REPL interface with:
Plugins are provided in the
plugins/folder within the main script file.
appargument. Each plugin can decorate the properties of the program and return the callback when finished.
Some usefully exposed properties:
|Object||Complex||The main application object - an instance of a |
|Array||Globs to search for plugins|
|Object||Complex||Repl options when creating the interface|
|Object||Any exported globals that should be available inside the REPL session|
|Array||Array of evaluation functions to run. Each Eval is run as a compose pipeline with the final output being returned to the REPL session|
|Number||2||How deeply to examine objects when printing results to the console|
|Boolean||Whether colors are enabled when printing results to the console|
以上是 @momsfriendlydevco/repl 的使用教程帮助文档。