1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-07 01:51:47 +02:00

Preserve readline history across sessions. Add rl_readline_name.

This commit is contained in:
Ole Jørgen Brønner 2016-02-23 23:19:49 +01:00
parent 5599665a27
commit 103c46abc2
2 changed files with 10 additions and 1 deletions

View file

@ -20,6 +20,7 @@ using namespace nix;
string programId = "nix-repl";
const string historyFile = string(getenv("HOME")) + "/.nix-repl-history";
struct NixRepl
@ -91,8 +92,10 @@ void NixRepl::mainLoop(const Strings & files)
reloadFiles();
if (!loadedFiles.empty()) std::cout << std::endl;
// Allow nix-repl specific settings in .inputrc
rl_readline_name = "nix-repl";
using_history();
read_history(0);
read_history(historyFile.c_str());
string input;
@ -649,5 +652,7 @@ int main(int argc, char * * argv)
store = openStore();
NixRepl repl(searchPath);
repl.mainLoop(files);
write_history(historyFile.c_str());
});
}