pub struct Shell { /* private fields */ }Expand description
A running shell.
Implementations§
Source§impl Shell
impl Shell
Sourcepub fn new(
options: &Options,
database: Database,
out: Box<dyn Write>,
err: Box<dyn Write>,
) -> Self
pub fn new( options: &Options, database: Database, out: Box<dyn Write>, err: Box<dyn Write>, ) -> Self
A shell over database, writing results to out and errors to err.
Sourcepub fn failed(&self) -> bool
pub fn failed(&self) -> bool
Whether anything has failed since the shell started, which is what the exit code is.
Sourcepub fn run_commands(&mut self, commands: &[Command]) -> Stop
pub fn run_commands(&mut self, commands: &[Command]) -> Stop
Runs everything the command line asked for, in order.
Sourcepub fn prompt(&mut self, stdin: &Stdin) -> Stop
pub fn prompt(&mut self, stdin: &Stdin) -> Stop
Reads and runs lines from a terminal until the user stops.
The continuation marker is what says the statement is not finished, and it is the reason
rudb::is_complete exists rather than the shell guessing from a trailing semicolon.
Sourcepub fn run_input(&mut self, text: &str) -> Stop
pub fn run_input(&mut self, text: &str) -> Stop
Runs a block of input, which may hold any mixture of dot commands and statements.
Line oriented rather than statement oriented, because a dot command is a line and SQL is
not. Lines accumulate into a statement until the tokenizer says the statement is finished,
which is how a multi line CREATE TABLE works at a prompt and in a file alike.