aboutsummaryrefslogtreecommitdiff
path: root/src/nix/repl.cc
diff options
context:
space:
mode:
authorBen Burdette <bburdette@gmail.com>2020-05-11 14:35:30 -0600
committerBen Burdette <bburdette@gmail.com>2020-05-11 14:35:30 -0600
commit59b1f5c70150a81c7a6fa0dc3309a9d44e9621f8 (patch)
tree542fc01dfaffdf7acbc5c1a89fd41a0918396f4b /src/nix/repl.cc
parent536bbf53e12c80f52c2679aec734d895b0058f5b (diff)
parent5bdb67c84308a8cc78ac633d27b94eca87ea4390 (diff)
Merge branch 'master' into errors-phase-2
Diffstat (limited to 'src/nix/repl.cc')
-rw-r--r--src/nix/repl.cc44
1 files changed, 10 insertions, 34 deletions
diff --git a/src/nix/repl.cc b/src/nix/repl.cc
index c770fd4a4..4bcaaeebf 100644
--- a/src/nix/repl.cc
+++ b/src/nix/repl.cc
@@ -82,40 +82,6 @@ struct NixRepl : gc
};
-void printHelp()
-{
- std::cout
- << "Usage: nix-repl [--help] [--version] [-I path] paths...\n"
- << "\n"
- << "nix-repl is a simple read-eval-print loop (REPL) for the Nix package manager.\n"
- << "\n"
- << "Options:\n"
- << " --help\n"
- << " Prints out a summary of the command syntax and exits.\n"
- << "\n"
- << " --version\n"
- << " Prints out the Nix version number on standard output and exits.\n"
- << "\n"
- << " -I path\n"
- << " Add a path to the Nix expression search path. This option may be given\n"
- << " multiple times. See the NIX_PATH environment variable for information on\n"
- << " the semantics of the Nix search path. Paths added through -I take\n"
- << " precedence over NIX_PATH.\n"
- << "\n"
- << " paths...\n"
- << " A list of paths to files containing Nix expressions which nix-repl will\n"
- << " load and add to its scope.\n"
- << "\n"
- << " A path surrounded in < and > will be looked up in the Nix expression search\n"
- << " path, as in the Nix language itself.\n"
- << "\n"
- << " If an element of paths starts with http:// or https://, it is interpreted\n"
- << " as the URL of a tarball that will be downloaded and unpacked to a temporary\n"
- << " location. The tarball must include a single top-level directory containing\n"
- << " at least a file named default.nix.\n";
-}
-
-
string removeWhitespace(string s)
{
s = chomp(s);
@@ -809,6 +775,16 @@ struct CmdRepl : StoreCommand, MixEvalArgs
return "start an interactive environment for evaluating Nix expressions";
}
+ Examples examples() override
+ {
+ return {
+ Example{
+ "Display all special commands within the REPL:",
+ "nix repl\n nix-repl> :?"
+ }
+ };
+ }
+
void run(ref<Store> store) override
{
auto repl = std::make_unique<NixRepl>(searchPath, openStore());