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  --fallbacks            on exit, print which kernels took the row at a time path
25  -f, -file FILENAME     run a file of SQL and exit
26  -header, -noheader     turn column names on or off
27  -init FILENAME         run a file of SQL before reading input
28  -interactive           show a prompt even when input is not a terminal
29  --metrics FILENAME     write what each statement measured, one JSON document per line
30  -newline SEP           what goes between rows in the separated modes
31  -nullvalue TEXT        what a null prints as
32  -readonly              open without allowing writes
33  -separator SEP         what goes between values in the separated modes
34  --set NAME=VALUE       run SET NAME = VALUE before anything else, repeatable
35  -version               print the version and exit
36  --print-config         print the build configuration and exit
37  -h, -help              print this and exit
38
39Most modes can also be given as an option: -ascii, -box, -column, -csv, -html, -json, -jsonlines,
40-line, -list, -markdown, -quote and -table. They set the mode and they do not all set the
41separators that .mode sets, which is what DuckDB does.
42";
43
44/// What `.help` prints.
45pub const DOT_COMMANDS: &str = "\
46.bail on|off             stop after the first error
47.databases               list the attached databases
48.echo on|off             print each statement before running it
49.exit                    exit the shell
50.headers on|off          turn column names on or off
51.help                    print this
52.mode MODE ?TABLE?       set the output mode
53.nullvalue TEXT          set what a null prints as
54.open FILENAME           close the current database and open another
55.output ?FILENAME?       send output to a file, or back to stdout
56.print TEXT...           print the text
57.quit                    exit the shell
58.read FILENAME           run a file of SQL
59.schema ?PATTERN?        show the CREATE TABLE for the tables
60.separator COL ?ROW?     set the separators used in the separated modes
61.show                    show the current settings
62.tables ?PATTERN?        list the tables
63.timer on|off            print how long each statement took
64";