about summary refs log tree commit diff
path: root/tvix/cli
diff options
context:
space:
mode:
authorAspen Smith <root@gws.fyi>2024-05-27T20·14-0400
committerclbot <clbot@tvl.fyi>2024-06-01T09·04+0000
commit55ec06b26b3919c30751c67b0c40c5840aa1ca38 (patch)
tree3c7af877c7c4b8ee5a6ecf72badeab502215e5ae /tvix/cli
parent70c4b512c2ca53f7e592c20bd9e200ac6a0ce853 (diff)
feat(tvix/repl): Implement :q, to quit r/8189
Change-Id: Ib3b314b21f4d8c30bfd674e79771179d51d4f2e9
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11736
Autosubmit: aspen <root@gws.fyi>
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/cli')
-rw-r--r--tvix/cli/src/repl.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/tvix/cli/src/repl.rs b/tvix/cli/src/repl.rs
index 7d29ae3d2c83..50c1779b0b68 100644
--- a/tvix/cli/src/repl.rs
+++ b/tvix/cli/src/repl.rs
@@ -18,12 +18,15 @@ fn state_dir() -> Option<PathBuf> {
 pub enum ReplCommand<'a> {
     Expr(&'a str),
     Explain(&'a str),
+    Quit,
 }
 
 impl<'a> ReplCommand<'a> {
     pub fn parse(input: &'a str) -> Self {
         if let Some(without_prefix) = input.strip_prefix(":d ") {
             Self::Explain(without_prefix)
+        } else if input.trim_end() == ":q" {
+            Self::Quit
         } else {
             Self::Expr(input)
         }
@@ -87,6 +90,7 @@ impl Repl {
                     };
 
                     let res = match ReplCommand::parse(input) {
+                        ReplCommand::Quit => break,
                         ReplCommand::Expr(input) => interpret(
                             Rc::clone(&io_handle),
                             input,