diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2023-02-03 22:42:36 -0500 |
---|---|---|
committer | John Ericson <John.Ericson@Obsidian.Systems> | 2023-02-20 09:45:29 -0500 |
commit | 1bd03ad100e8813751b6c08b0c21ae8cf5a9c21d (patch) | |
tree | 2e625eda7966d2e10bf7316ae8fa352eaa100b27 /src/libcmd/command.cc | |
parent | 57a2e46ee0890093c9882f961d7d95c56d7c0ad5 (diff) |
Split out `CmdRepl` and `editorFor`
The REPL itself and the `nix repl` CLI are conceptually different
things, and thus deserve to be in different files.
Diffstat (limited to 'src/libcmd/command.cc')
-rw-r--r-- | src/libcmd/command.cc | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/src/libcmd/command.cc b/src/libcmd/command.cc index 517cdf617..ab51c229d 100644 --- a/src/libcmd/command.cc +++ b/src/libcmd/command.cc @@ -4,6 +4,7 @@ #include "derivations.hh" #include "nixexpr.hh" #include "profiles.hh" +#include "repl.hh" #include <nlohmann/json.hpp> @@ -121,7 +122,7 @@ ref<EvalState> EvalCommand::getEvalState() ; if (startReplOnEvalErrors) { - evalState->debugRepl = &runRepl; + evalState->debugRepl = &AbstractNixRepl::runSimple; }; } return ref<EvalState>(evalState); @@ -218,20 +219,6 @@ void StorePathCommand::run(ref<Store> store, std::vector<StorePath> && storePath run(store, *storePaths.begin()); } -Strings editorFor(const Path & file, uint32_t line) -{ - auto editor = getEnv("EDITOR").value_or("cat"); - auto args = tokenizeString<Strings>(editor); - if (line > 0 && ( - editor.find("emacs") != std::string::npos || - editor.find("nano") != std::string::npos || - editor.find("vim") != std::string::npos || - editor.find("kak") != std::string::npos)) - args.push_back(fmt("+%d", line)); - args.push_back(file); - return args; -} - MixProfile::MixProfile() { addFlag({ |