From c672d51b77412424b0fd1a199acee758822ba732 Mon Sep 17 00:00:00 2001 From: JetSquirrel Date: Fri, 25 Sep 2026 14:15:35 +0800 Subject: [PATCH] Say in --help what --limit stops now that results stream Co-Authored-By: Claude Opus 5.5 (1M context) --- src/cli.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cli.rs b/src/cli.rs index 3144c7f..389b24d 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -6,7 +6,7 @@ use std::ptr; use duckdb::{ffi, AccessMode, Config, Connection}; use serde_json::json; -pub(crate) const HELP: &str = "DuckLocal — local data workspace and headless SQL\n\nUsage:\n ducklocal [PATH ...] Open the GUI (files, folders, globs)\n ducklocal query --sql SQL [OPTIONS] Execute one statement, return JSON\n ducklocal query --sql-file FILE [OPTIONS]\n ducklocal profile TARGET [--database PATH] Per-column statistics, JSON\n ducklocal export --html [OPTIONS] APP App data as a standalone HTML file\n ducklocal check FILE [--database PATH] Validate a .dash dashboard spec\n ducklocal lsp [--database PATH] Language server for .dash files (stdio)\n ducklocal --help\n ducklocal --version\n\nQuery options:\n --sql SQL SQL text; exactly one of --sql and --sql-file is required\n --sql-file FILE UTF-8 SQL file; - reads stdin\n --database PATH File database; must exist, opened read-only by default\n --read-write Allow database writes/creation (requires --database)\n --limit N Maximum returned rows, default 1000; positive integer\n --format FORMAT json (default) or md, a Markdown table to read and quote\n --help Show this help\n\nOutput: one JSON object with columns, rows, row_count, truncated, elapsed_ms.\nColumn types are Arrow debug names, not SQL type names. A 2,000,000-cell\nbudget also applies. Limits constrain output, not computation. --format md\nrenders the same values as readable text: dates and timestamps in ISO form,\nDECIMALs with their digits, NULL as NULL. It is a rendering, not the contract;\nuse JSON where a caller parses the result.\nErrors: JSON on stderr, empty stdout; exit 2 for arguments, 1 for SQL/I/O.\nRead-only is NOT a filesystem/network sandbox: COPY can write files.\nExtensions are not automatically installed. GUI state/history is not used.\nA GUI path named `query`, `profile`, `export`, `check`, `dash` or `lsp` must be written ./query, ./profile, ./export, ./check, ./dash, ./lsp.\n\nProfile: TARGET is a data file (csv/tsv/parquet/json) or a workbook\n(xlsx/xls/xlsb/ods; its first sheet is imported and profiled), or, with\n--database, a table or view name. Per column it reports type, nulls, distinct,\nmin, max; for numbers the decimals actually used, the median and\nmax_over_median; for dates covered_days, span_days and missing_days.\nStatistics are exact and read the whole relation.\n\nExport: APP is an analysis app folder (main.js) or its entry file.\nThe app is run once, in a hidden window, and the statements its query()\ncalls issue are captured with their results. Output is one JSON object naming\nthe written file; the file itself is self-contained HTML with no JavaScript.\nExport options:\n --html Required; the only format\n --out FILE Destination; defaults to ./.html\n --force Replace an existing destination\n --database PATH File database; must exist, opened read-only by default\n --read-write Allow database writes/creation (requires --database)\n --timeout SECONDS Capture time limit, default 15\n\nCheck: FILE is a .dash dashboard spec — query blocks holding SQL heredocs,\nplot blocks with type/query/x/y/series attributes, references like\nquery.latency between them. The check parses the file, resolves every\nreference and attribute, and validates each query's SQL with the real DuckDB\nparser; nothing executes and no table needs to exist. With --database it\nalso runs every query on that database (read-only), so an error that only\nshows once rows are read fails the check, and checks each plot's\nx/y/series against the columns the query actually returns.\nOutput: one JSON object with the file's queries and plots; a spec mistake is\nexit 2 with one line per diagnostic, a database or I/O failure is exit 1\n(a failing query is one line each, all of them).\n\nLsp: a Language Server Protocol server for .dash files, over stdio, for\neditors to spawn. Full-document sync; on every open and change it publishes\nthe same parse and semantic diagnostics `check` reports (exit-2 mistakes,\nall severity Error), plus each query's SQL through the real DuckDB parser\nwhen --database is given. Completion offers block, attribute, type and\nquery-name candidates; hover documents blocks, attributes and references;\ngo-to-definition jumps a query.name reference to its query block. Exit 0 on\na clean shutdown, 1 if the client goes away without one, 2 for a bad command\nline or a failed protocol handshake.\n"; +pub(crate) const HELP: &str = "DuckLocal — local data workspace and headless SQL\n\nUsage:\n ducklocal [PATH ...] Open the GUI (files, folders, globs)\n ducklocal query --sql SQL [OPTIONS] Execute one statement, return JSON\n ducklocal query --sql-file FILE [OPTIONS]\n ducklocal profile TARGET [--database PATH] Per-column statistics, JSON\n ducklocal export --html [OPTIONS] APP App data as a standalone HTML file\n ducklocal check FILE [--database PATH] Validate a .dash dashboard spec\n ducklocal lsp [--database PATH] Language server for .dash files (stdio)\n ducklocal --help\n ducklocal --version\n\nQuery options:\n --sql SQL SQL text; exactly one of --sql and --sql-file is required\n --sql-file FILE UTF-8 SQL file; - reads stdin\n --database PATH File database; must exist, opened read-only by default\n --read-write Allow database writes/creation (requires --database)\n --limit N Maximum returned rows, default 1000; positive integer\n --format FORMAT json (default) or md, a Markdown table to read and quote\n --help Show this help\n\nOutput: one JSON object with columns, rows, row_count, truncated, elapsed_ms.\nColumn types are Arrow debug names, not SQL type names. A 2,000,000-cell\nbudget also applies. A scan stops at the limit; ORDER BY, GROUP BY and\naggregates still compute over every row first. --format md\nrenders the same values as readable text: dates and timestamps in ISO form,\nDECIMALs with their digits, NULL as NULL. It is a rendering, not the contract;\nuse JSON where a caller parses the result.\nErrors: JSON on stderr, empty stdout; exit 2 for arguments, 1 for SQL/I/O.\nRead-only is NOT a filesystem/network sandbox: COPY can write files.\nExtensions are not automatically installed. GUI state/history is not used.\nA GUI path named `query`, `profile`, `export`, `check`, `dash` or `lsp` must be written ./query, ./profile, ./export, ./check, ./dash, ./lsp.\n\nProfile: TARGET is a data file (csv/tsv/parquet/json) or a workbook\n(xlsx/xls/xlsb/ods; its first sheet is imported and profiled), or, with\n--database, a table or view name. Per column it reports type, nulls, distinct,\nmin, max; for numbers the decimals actually used, the median and\nmax_over_median; for dates covered_days, span_days and missing_days.\nStatistics are exact and read the whole relation.\n\nExport: APP is an analysis app folder (main.js) or its entry file.\nThe app is run once, in a hidden window, and the statements its query()\ncalls issue are captured with their results. Output is one JSON object naming\nthe written file; the file itself is self-contained HTML with no JavaScript.\nExport options:\n --html Required; the only format\n --out FILE Destination; defaults to ./.html\n --force Replace an existing destination\n --database PATH File database; must exist, opened read-only by default\n --read-write Allow database writes/creation (requires --database)\n --timeout SECONDS Capture time limit, default 15\n\nCheck: FILE is a .dash dashboard spec — query blocks holding SQL heredocs,\nplot blocks with type/query/x/y/series attributes, references like\nquery.latency between them. The check parses the file, resolves every\nreference and attribute, and validates each query's SQL with the real DuckDB\nparser; nothing executes and no table needs to exist. With --database it\nalso runs every query on that database (read-only), so an error that only\nshows once rows are read fails the check, and checks each plot's\nx/y/series against the columns the query actually returns.\nOutput: one JSON object with the file's queries and plots; a spec mistake is\nexit 2 with one line per diagnostic, a database or I/O failure is exit 1\n(a failing query is one line each, all of them).\n\nLsp: a Language Server Protocol server for .dash files, over stdio, for\neditors to spawn. Full-document sync; on every open and change it publishes\nthe same parse and semantic diagnostics `check` reports (exit-2 mistakes,\nall severity Error), plus each query's SQL through the real DuckDB parser\nwhen --database is given. Completion offers block, attribute, type and\nquery-name candidates; hover documents blocks, attributes and references;\ngo-to-definition jumps a query.name reference to its query block. Exit 0 on\na clean shutdown, 1 if the client goes away without one, 2 for a bad command\nline or a failed protocol handshake.\n"; #[derive(Debug)] pub(crate) struct CliError {