Skip to content

Commit 4c4d28a

Browse files
author
Victor Bjelkholm
committed
Save repl history
1 parent 1a56d72 commit 4c4d28a

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ var repl = require('repl')
33
var npmi = require('npmi')
44
var path = require('path')
55
var colors = require('colors')
6+
var replHistory = require('repl.history')
67

78
const TRYMODULE_PATH = process.env.TRYMODULE_PATH || path.resolve((process.env.HOME || process.env.USERPROFILE), '.trymodule')
9+
const TRYMODULE_HISTORY_PATH = process.env.TRYMODULE_HISTORY_PATH || path.resolve(TRYMODULE_PATH, 'repl_history')
810

911
if (process.argv[2] === undefined) {
1012
throw new Error('You need to provide package name as first argument')
@@ -66,6 +68,7 @@ Promise.all(promises_for_installation).then((packages) => {
6668
var replServer = repl.start({
6769
prompt: '> '
6870
})
71+
replHistory(replServer, TRYMODULE_HISTORY_PATH)
6972
replServer.context = Object.assign(replServer.context, context_packages)
7073
}
7174
})

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
"license": "MIT",
1515
"dependencies": {
1616
"colors": "^1.1.2",
17-
"npmi": "^1.0.1"
17+
"npmi": "^1.0.1",
18+
"repl.history": "^0.1.3"
1819
},
1920
"devDependencies": {
2021
"standard": "^6.0.8"

0 commit comments

Comments
 (0)