princejwesley/Mancy

[idea] mancy for terminal/console

sibelius opened this issue · 4 comments

Mancy idea is really great

But I would like to use it on terminal instead of an electron app

Maybe we could split Mancy in mancy core that could work on both electron app and with terminal based approach

My current approach to have a node repl running my server is like this

import "reify/repl";
import 'isomorphic-fetch';
import 'babel-polyfill';
import REPL from 'repl';
import replPromised from 'repl-promised';
import * as models from './src/models';

(async() => {
  try {
    const info = await connectDatabase();
    console.log(`Connected to ${info.host}:${info.port}/${info.name}`);

    let repl = REPL.start({
      prompt: 'repl > ',
    });
    repl.context.M = models;
    replPromised.promisify(repl);
  } catch (error) {
    console.error('Unable to connect to database');
    process.exit(1);
  }
})();

Instead of replPromised we could use mancy-core to provide all the awesome features of Mancy

@sibelius I am currently interested in making core node REPL better. Here is a proposal

this would be awesome, but what happens with the older version of node?

can't we try to do both approach?

I don't know if you know ipython (an interactive repl for python)

I think core node REPL should provide the bare minimum, and let other solutions like this one provide extensions

Or it could be an NPM that ships with core. In that way,

  • newer nodejs could get it by default
  • while people with older one can still get it
  • it can be updated independently from core update.

I think we can extract a preprocess function from Mancy like this: https://gist.github.com/princejwesley/a66d514d86ea174270210561c44b71ba

from here:

let cook = (plain) => {

and add one node repl

I'll post here, if I create a package or a repo example using this idea