aboutsummaryrefslogtreecommitdiff
path: root/src/libcmd/repl.cc
diff options
context:
space:
mode:
authorJade Lovelace <lix@jade.fyi>2024-03-09 23:59:50 -0800
committerJade Lovelace <lix@jade.fyi>2024-03-11 14:14:43 -0700
commitbe2b87ed4dda865406096196804b784f4c293687 (patch)
treec4793e79fcbb4e3c29ad27931a072969c75b054d /src/libcmd/repl.cc
parentb06a39211460033305c5264a456161c75ed88425 (diff)
add automated usage mode to the repl
This is definitely not a stable thing, but it does feel slightly crimes to put it as an experimental feature. Shrug, up for bikeshedding. Change-Id: I6ef176e3dee6fb1cac9c0a7a60d553a2c63ea728
Diffstat (limited to 'src/libcmd/repl.cc')
-rw-r--r--src/libcmd/repl.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/libcmd/repl.cc b/src/libcmd/repl.cc
index 5809ab285..9e5599152 100644
--- a/src/libcmd/repl.cc
+++ b/src/libcmd/repl.cc
@@ -121,6 +121,12 @@ std::string removeWhitespace(std::string s)
return s;
}
+static box_ptr<ReplInteracter> makeInteracter() {
+ if (experimentalFeatureSettings.isEnabled(Xp::ReplAutomation))
+ return make_box_ptr<AutomationInteracter>();
+ else
+ return make_box_ptr<ReadlineLikeInteracter>(getDataDir() + "/nix/repl-history");
+}
NixRepl::NixRepl(const SearchPath & searchPath, nix::ref<Store> store, ref<EvalState> state,
std::function<NixRepl::AnnotatedValues()> getValues)
@@ -128,7 +134,7 @@ NixRepl::NixRepl(const SearchPath & searchPath, nix::ref<Store> store, ref<EvalS
, debugTraceIndex(0)
, getValues(getValues)
, staticEnv(new StaticEnv(nullptr, state->staticBaseEnv.get()))
- , interacter(make_box_ptr<ReadlineLikeInteracter>(getDataDir() + "/nix/repl-history"))
+ , interacter(makeInteracter())
{
}