Skip to main content

Crate rudb_cli

Crate rudb_cli 

Source
Expand description

The command line shell.

Rank 15 in the layer rule. See xtask/layers.toml and spec/18-package-layout.md.

The binary is a few lines over this, so that the shell can be driven from a test without spawning a process and so that rudb-compat can drive it as a target the same way it drives the library. Everything the shell does goes through rudb::Database, which means the shell has no way to reach anything the embedding API cannot, which is the point: if the prompt can do it, a program can do it. The manifest says the same thing in the form the compiler checks, which is that rudb is the only dependency.

Statements run on a rudb::Connection rather than on the database directly, which is the thing an interrupt has to reach. What is not here is the signal handler that would call rudb::Connection::interrupt, because installing one needs libc and the dependency budget in spec/18-package-layout.md is a decision to make on purpose rather than in passing. That is the same decision line editing is waiting behind. The library half is done and tested, so the shell side is a handler and a clone of the connection the day the dependency is settled.

The command line and the dot commands are DuckDB’s, down to the single dash long options it inherits from SQLite. The output modes are DuckDB’s too, byte for byte, because the reason anybody pipes a shell into another program is that they already know what comes out.

Re-exports§

pub use args::Action;
pub use args::Command;
pub use args::Options;
pub use args::parse;
pub use format::Format;
pub use format::Settings;
pub use shell::Shell;
pub use shell::Stop;

Modules§

args
The command line, in DuckDB’s spelling.
format
The output modes.
help
The text the shell prints about itself.
shell
The shell itself: read a line, decide whether it is SQL or a dot command, run it, print it.

Constants§

VERSION
The version, which -version prints and which the greeting carries.

Functions§

run
The whole program, minus the process it runs in.