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