Skip to main content

rudb_cli/
help.rs

1//! The text the shell prints about itself.
2//!
3//! Kept together so that adding an option and forgetting to document it is one file to notice
4//! rather than two.
5
6/// The list of modes, which both `.help` and the error from a bad `.mode` want.
7pub const MODES: &str = "ascii, box, column, csv, duckbox, html, insert, json, jsonlines, line, list, markdown, quote, table, tabs, trash";
8
9/// What `-help` prints.
10pub const USAGE: &str = "\
11Usage: rudb [OPTIONS] [FILENAME [SQL...]]
12
13An embedded analytical database, compatible with DuckDB.
14
15FILENAME is the database to open. Only :memory: works today, because there is no storage format
16yet. A second argument is SQL to run, after which the shell exits.
17
18Options:
19  -bail                  stop after the first error
20  -batch                 read input as a script even when it is a terminal
21  -c, -s SQL             run SQL and exit
22  -cmd SQL               run SQL before reading input, and keep reading
23  -echo                  print each statement before running it
24  -f, -file FILENAME     run a file of SQL and exit
25  -header, -noheader     turn column names on or off
26  -init FILENAME         run a file of SQL before reading input
27  -interactive           show a prompt even when input is not a terminal
28  -newline SEP           what goes between rows in the separated modes
29  -nullvalue TEXT        what a null prints as
30  -readonly              open without allowing writes
31  -separator SEP         what goes between values in the separated modes
32  -version               print the version and exit
33  --print-config         print the build configuration and exit
34  -h, -help              print this and exit
35
36Any mode can also be given as an option, so -csv is the same as -cmd '.mode csv'.
37";
38
39/// What `.help` prints.
40pub const DOT_COMMANDS: &str = "\
41.bail on|off             stop after the first error
42.databases               list the attached databases
43.echo on|off             print each statement before running it
44.exit                    exit the shell
45.headers on|off          turn column names on or off
46.help                    print this
47.mode MODE ?TABLE?       set the output mode
48.nullvalue TEXT          set what a null prints as
49.open FILENAME           close the current database and open another
50.output ?FILENAME?       send output to a file, or back to stdout
51.print TEXT...           print the text
52.quit                    exit the shell
53.read FILENAME           run a file of SQL
54.schema ?PATTERN?        show the CREATE TABLE for the tables
55.separator COL ?ROW?     set the separators used in the separated modes
56.show                    show the current settings
57.tables ?PATTERN?        list the tables
58.timer on|off            print how long each statement took
59";