diff --git a/repl.js b/repl.js index cff6868..0a88ee5 100755 --- a/repl.js +++ b/repl.js @@ -2,12 +2,16 @@ const assert = require('assert'); const Bee = require('bee-queue'); +const path = require('path'); const redis = require('redis'); const repl = require('repl'); +const { homedir } = require('os'); const sift = require('sift').default; const getValue = require('get-value'); const { decorateIt } = require('./iterUtils'); +const DEFAULT_HISTORY_PATH = path.join(homedir(), '.combee_history'); + const argv = require('yargs') .options({ redis: { @@ -350,6 +354,15 @@ const rpl = repl.start({ ignoreUndefined: true, }); +const historyPath = process.env.COMBEE_HISTORY || DEFAULT_HISTORY_PATH; +rpl.setupHistory(historyPath, (err) => { + if (!err) { + return; + } + console.error('Could not setup history file at', historyPath); + console.error(err); +}); + rpl.context.combee = combee; if (!!argv.loadFunctions) {