diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2017-04-25T14·57+0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2017-04-25T14·57+0200 |
commit | fee93541a441b35cb62b11dd1c2c787a5df63b15 (patch) | |
tree | 76c8a3736c1b521c1a9e7920b1742981cb07ad81 /nix-repl.cc | |
parent | 2dff9556a4131af8a50647f23fe03bfc3c295e12 (diff) | |
parent | 103c46abc273266afcd5dbffa40151114234a02b (diff) |
Merge branch 'master' of https://github.com/olejorgenb/nix-repl
Diffstat (limited to 'nix-repl.cc')
-rw-r--r-- | nix-repl.cc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/nix-repl.cc b/nix-repl.cc index 0c50f4683300..71790eb481a7 100644 --- a/nix-repl.cc +++ b/nix-repl.cc @@ -29,6 +29,9 @@ using namespace nix; #define ESC_CYA "\033[36m" #define ESC_END "\033[0m" +string programId = "nix-repl"; +const string historyFile = string(getenv("HOME")) + "/.nix-repl-history"; + struct NixRepl { string curDir; @@ -127,8 +130,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; @@ -708,5 +713,7 @@ int main(int argc, char * * argv) NixRepl repl(searchPath, openStore()); repl.mainLoop(files); + + write_history(historyFile.c_str()); }); } |