Coder Social home page Coder Social logo

REPL history. about n_ HOT 4 CLOSED

borisdiakur avatar borisdiakur commented on May 18, 2024
REPL history.

from n_.

Comments (4)

borisdiakur avatar borisdiakur commented on May 18, 2024

trymodule looks cool. But I'm even more impressed by the colors.rainbow function. We should definitely include it into n_! I’ll send you a PR for lodash! 😁

Regarding the history feature: I’ve been thinking about it before because I was missing it myself in n_. You can save the repl session into a file manually using the command .save but that’s inconvenient.
The only aspect I don’t like about the repl.history module is that I’d have to add it as a dependency. I like n_ being dependent only on lodash. That’s why I was thinking of integrating session persistence “the native way”. Seems like I can load and save the last session using the following four lines of code:

// load the last session after server start
server.commands.load.action.apply(server, [path.join(process.env.HOME, 'n_repl_history')]);
// save the session on exit
process.on('exit', function () {
    server.commands.save.action.apply(server, [path.join(process.env.HOME, 'n_repl_history')]);
});

What do you think?

from n_.

jdalton avatar jdalton commented on May 18, 2024

I don't mind the extra dep. The neat thing about a shared history package is that if others use it, like trymodule, then history persists across tools which is nice.

from n_.

borisdiakur avatar borisdiakur commented on May 18, 2024

If there just wasn’t that incompatibility issue tmpvar/repl.history#6 ...
Anyway, you're right. A shared history between different repls would be neat. This would however require all repls to use the same file path, which currently is not guaranteed by repl.history because the file path is an option.

from n_.

jdalton avatar jdalton commented on May 18, 2024

👍

from n_.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.