about summary refs log tree commit diff
path: root/tvix/cli/src/repl.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tvix/cli/src/repl.rs')
-rw-r--r--tvix/cli/src/repl.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/tvix/cli/src/repl.rs b/tvix/cli/src/repl.rs
index a970aa1ba75d..5a4830a027bc 100644
--- a/tvix/cli/src/repl.rs
+++ b/tvix/cli/src/repl.rs
@@ -18,6 +18,7 @@ fn state_dir() -> Option<PathBuf> {
 pub enum ReplCommand<'a> {
     Expr(&'a str),
     Explain(&'a str),
+    Print(&'a str),
     Quit,
     Help,
 }
@@ -30,6 +31,7 @@ The following commands are supported:
 
   <expr>    Evaluate a Nix language expression and print the result, along with its inferred type
   :d <expr> Evaluate a Nix language expression and print a detailed description of the result
+  :p <expr> Evaluate a Nix language expression and print the result recursively
   :q        Exit the REPL
   :?, :h    Display this help text
 ";
@@ -38,6 +40,8 @@ The following commands are supported:
         if input.starts_with(':') {
             if let Some(without_prefix) = input.strip_prefix(":d ") {
                 return Self::Explain(without_prefix);
+            } else if let Some(without_prefix) = input.strip_prefix(":p ") {
+                return Self::Print(without_prefix);
             }
 
             let input = input.trim_end();
@@ -130,6 +134,17 @@ impl Repl {
                             true,
                             AllowIncomplete::Allow,
                         ),
+                        ReplCommand::Print(input) => interpret(
+                            Rc::clone(&io_handle),
+                            input,
+                            None,
+                            &Args {
+                                strict: true,
+                                ..(args.clone())
+                            },
+                            false,
+                            AllowIncomplete::Allow,
+                        ),
                     };
 
                     match res {