featurebase/cmd
Travis Turner 87011e4294
CLI: make it more like psql (#2235)
* Refactor CLI to mimic psql's meta-commands

This PR adds support for meta-commands (also known as "backslash
commands") like those in psql, Postgres's CLI. Only a few meta-commands
are currently implemented, but this was meant to demonstrate how we
could use something like `\i file.csv` to insert local files into SQL
statements.

* Meta-commands: \file and \include

The initial implementation used `\i` as a streaming file handle.

This commit changes that to `\file`, and then implements `\i` (or
`\include`) as handling multiple sql commands.

* Add meta-command "help" (\?)

This is basically a copy of the psql help output, but includes only
those options we currently support.

* Add support for \o [file], and \timing

The \o meta-command writes query output to a file.

The \timing meta-command turns on/off the timing display sent to stdout.

* Add meta-commands: \l (show databases) and \dt (show tables)

* Add meta-command: \watch [period]

* Update meta-command \connect to take database name instead of ID

* Add support for \echo, \qecho, and \warn

This commit contains an known issue in that the `-n` option will exclude
the line feed, but if the output is the terminal, the readline package
clobbers any content on the current line (i.e. anything without a line
feed). That will need to be addressed at some point.

* Add support for \w [FILE] (write query buffer to file)

* Add SchemaAPI no-op implementation

* Refactor query handler to align with /sql and /databases endpoints

We want to standardize on:
/sql
/databases/{databaseID}/sql

* Add CLI support for expanded, border, tuples_only (and pset)

* Add help text for \pset and \t
2023-02-14 09:23:51 -06:00
..
badloader Fixed some import issues resulting from syncing the private repo 2022-11-17 08:58:22 -08:00
featurebase FB-1766: cleaning up the CmdIO objects passing alternate stdin/ 2022-12-12 09:01:20 -08:00
featurebase-parse-sql cleaned up sync from private repo 2022-09-30 11:20:58 -07:00
pilosa-bench fix: updating code to meet linting requirements (#2171) 2022-09-29 12:34:29 -04:00
roaring-migrate staticcheck fixes (#2278) 2022-11-15 11:33:10 -08:00
slurp staticcheck fixes (#2278) 2022-11-15 11:33:10 -08:00
auth_token.go Sync from private repo to commit 12d608c80d 2022-12-12 09:01:20 -08:00
backup.go Sync from private repo to commit 12d608c80d 2022-12-12 09:01:20 -08:00
backup_tar.go fix import paths and import cycles 2023-01-12 00:31:14 +00:00
chksum.go Sync from private repo to commit 12d608c80d 2022-12-12 09:01:20 -08:00
cli.go CLI: make it more like psql (#2235) 2023-02-14 09:23:51 -06:00
config.go FB-1766: cleaning up the CmdIO objects passing alternate stdin/ 2022-12-12 09:01:20 -08:00
dataframe-csv-loader.go fix import paths 2023-01-11 18:59:24 +00:00
dax.go Sync from private repo to commit 12d608c80d 2022-12-12 09:01:20 -08:00
doc.go Updated code to latest version for open-sourcing. 2022-09-02 13:23:39 -07:00
export.go Sync from private repo to commit 12d608c80d 2022-12-12 09:01:20 -08:00
export_test.go Updated dependency paths to reflect new repo location 2022-09-06 09:39:22 -07:00
generate_config.go Sync from private repo to commit 12d608c80d 2022-12-12 09:01:20 -08:00
import.go Sync from private repo to commit 12d608c80d 2022-12-12 09:01:20 -08:00
import_test.go Sync from private repo to commit 12d608c80d 2022-12-12 09:01:20 -08:00
keygen.go Sync from private repo to commit 12d608c80d 2022-12-12 09:01:20 -08:00
parquet-info.go parquet-info command to browse parquet files (#2230) 2023-01-26 12:55:54 -06:00
presort.go Fix pre sort cmd (#2222) 2023-01-25 11:01:58 -06:00
rbf.go Sync from private repo to commit 12d608c80d 2022-12-12 09:01:20 -08:00
restore.go Sync from private repo to commit 12d608c80d 2022-12-12 09:01:20 -08:00
restore_tar.go Sync from private repo to commit 12d608c80d 2022-12-12 09:01:20 -08:00
root.go parquet-info command to browse parquet files (#2230) 2023-01-26 12:55:54 -06:00
root_test.go Sync from private repo to commit 12d608c80d 2022-12-12 09:01:20 -08:00
server.go move DD profiling/tracing setup into command where it belongs (#2233) 2023-02-01 16:20:39 -06:00
server_test.go Sup 294 pre sort command (#2209) 2023-01-23 12:26:38 -06:00