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