Skip to content

thebopshoobop/repl-history

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commits
 
 
 
 
 
 
 
 

Repository files navigation

repl-history

This package allows you to easily include history into your custom REPL. By default it will create a .repl_history file in the project directory and keep the most recent 200 lines. You can adjust those settings by passing appropriate options.

Quickstart

Install: npm i repl-history

const repl = require('repl').start()
require('repl-history')(repl)

Options

You can pass an options object as a second parameter.

  • filePath (string, [project_dir]/.repl_history): Specify an alternative file. Must be a fully-qualified path.
  • useHome (boolean, false): Use the user's default history file ~/.node_repl_history. This option supercedes filePath.
  • maxSave (number, 200): The maximum number of lines to save. Set to 0 to save all lines.

Examples

// specify a different file name
const path = require("path")
const repl = require('repl').start()
require('repl-history')(repl, {filePath: path.join(__dirname, "commands")})
// use the home history file, keep 600 lines
const repl = require('repl').start()
require('repl-history')(repl, {useHome: true, maxSave: 600})

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published