From 346279f9bb22785df36bb33a79e7167b264a42f5 Mon Sep 17 00:00:00 2001 From: Joan Martinez Date: Fri, 12 Jul 2024 11:57:02 +0200 Subject: [PATCH] add help message to CLI --- cli/main.rs | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/cli/main.rs b/cli/main.rs index 13aecd803..d95e0ce99 100644 --- a/cli/main.rs +++ b/cli/main.rs @@ -75,6 +75,38 @@ fn main() -> anyhow::Result<()> { Ok(()) } +fn display_help_message() { + let help_message = r#" +Limbo SQL Shell Help +============== + +Welcome to the Limbo SQL Shell! You can execute any standard SQL command here. +In addition to standard SQL commands, the following special commands are available: + +Special Commands: +----------------- +.schema Show the schema of the specified table. +.opcodes Display all the opcodes defined by the virtual machine +.help Display this help message. + +Usage Examples: +--------------- +1. To view the schema of a table named 'employees': + .schema employees + +2. To list all available SQL opcodes: + .opcodes + +Note: +----- +- All SQL commands must end with a semicolon (;). +- Special commands do not require a semicolon. + +"#; + + println!("{}", help_message); +} + fn handle_dot_command( io: Rc, conn: &limbo_core::Connection, @@ -104,6 +136,9 @@ fn handle_dot_command( } } } + ".help" => { + display_help_message(); + } _ => { println!("Unknown command: {}", args[0]); println!("Available commands:");