cli: Improve .schema command output on errors

Improve `.schema` output on errors by marking them as comments. This
allows you to pipe any `.schema` output to another shell.
This commit is contained in:
Pekka Enberg
2025-01-16 14:08:37 +02:00
parent 465c923db1
commit f711d2b7ed
2 changed files with 3 additions and 3 deletions

View File

@@ -724,9 +724,9 @@ impl Limbo {
if !found { if !found {
if let Some(table_name) = table { if let Some(table_name) = table {
let _ = self let _ = self
.write_fmt(format_args!("Error: Table '{}' not found.", table_name)); .write_fmt(format_args!("-- Error: Table '{}' not found.", table_name));
} else { } else {
let _ = self.writeln("No tables or indexes found in the database."); let _ = self.writeln("-- No tables or indexes found in the database.");
} }
} }
} }

View File

@@ -227,7 +227,7 @@ do_execshell_test(
pipe, pipe,
"test-can-switch-back-to-in-memory", "test-can-switch-back-to-in-memory",
".schema users", ".schema users",
"Error: Table 'users' not found.", "-- Error: Table 'users' not found.",
) )
do_execshell_test(pipe, "test-verify-null-value", "select NULL;", "LIMBO") do_execshell_test(pipe, "test-verify-null-value", "select NULL;", "LIMBO")