feat(help): distinct help for advanced-mode SQL forms; split list by mode (#36)
The six advanced SQL DML/query forms (SELECT, WITH, SQL_INSERT, SQL_UPDATE, SQL_DELETE, EXPLAIN_SQL) carried help_id: None, so `help select`/`help with` resolved to nothing and `help insert` showed only the simple form. Give each its own distinct help_id (data.select, data.sql_insert, …) with a hand-curated help.data.* page. Distinct strings keep the dedup invariant intact, and note_help_topic needs no change — `help insert` now shows the simple block and the sql_insert block (like `help create` already did), and the advanced-only forms resolve. note_help now groups the list by CommandCategory: app-lifecycle commands first (unlabelled), then "Simple-mode commands:" and "Advanced-mode (SQL) commands:" sections — replacing the old single "DSL data commands (in simple mode):" header, which used the banned "DSL" term and mis-labelled the advanced SQL forms it already contained. Four new help_command tests (red→green). Recorded as ADR-0024 Amendment 1; CHANGELOG updated.
This commit is contained in:
@@ -180,7 +180,8 @@ pub const KEYS_AND_PLACEHOLDERS: &[(&str, &[&str])] = &[
|
||||
// In-app `help` — framing + per-command entries keyed by
|
||||
// each CommandNode's `help_id` (ADR-0024 §help_id).
|
||||
("help.intro", &[]),
|
||||
("help.dsl_section", &[]),
|
||||
("help.simple_section", &[]),
|
||||
("help.advanced_section", &[]),
|
||||
("help.types_reference", &[]),
|
||||
("help.detail_hint", &[]),
|
||||
("help.unknown_topic", &["topic"]),
|
||||
@@ -223,6 +224,13 @@ pub const KEYS_AND_PLACEHOLDERS: &[(&str, &[&str])] = &[
|
||||
("help.data.delete", &[]),
|
||||
("help.data.replay", &[]),
|
||||
("help.data.explain", &[]),
|
||||
// Issue #36: advanced-mode (SQL) help pages.
|
||||
("help.data.select", &[]),
|
||||
("help.data.with", &[]),
|
||||
("help.data.sql_insert", &[]),
|
||||
("help.data.sql_update", &[]),
|
||||
("help.data.sql_delete", &[]),
|
||||
("help.data.explain_sql", &[]),
|
||||
// ---- Hint panel ambient typing assistance (ADR-0022 §6) ----
|
||||
("hint.ambient_complete", &[]),
|
||||
("hint.ambient_error_with_usage", &["message", "usage"]),
|
||||
|
||||
@@ -246,7 +246,13 @@ help:
|
||||
# are multi-line-capable — the renderer emits one output row
|
||||
# per line so scroll math stays accurate.
|
||||
intro: "Supported commands:"
|
||||
dsl_section: "DSL data commands (in simple mode):"
|
||||
# Issue #36: the command list groups by mode. App-lifecycle commands list
|
||||
# first (unlabelled, under the intro — they work in either mode); the rest
|
||||
# split into these two sections by command category. (Replaces the old
|
||||
# single "DSL data commands (in simple mode):" header, which used the banned
|
||||
# "DSL" term and mis-labelled the advanced SQL forms it already contained.)
|
||||
simple_section: "Simple-mode commands:"
|
||||
advanced_section: "Advanced-mode (SQL) commands:"
|
||||
# H3: footer on the full `help` list, and the not-found note
|
||||
# for `help <topic>`. `{topic}` is the word the user typed.
|
||||
detail_hint: "Type `help <command>` for detail on one command (e.g. `help insert`), or `help types` for the type reference."
|
||||
@@ -368,8 +374,25 @@ help:
|
||||
explain show data <T> | explain update <T> ... | explain delete from <T> ...
|
||||
— show how the database would run a query, without
|
||||
running it (safe even for update / delete)
|
||||
explain <select|with|insert|update|delete …> (advanced mode)
|
||||
— the same plan for the SQL you wrote
|
||||
# Issue #36: advanced-mode (SQL) forms. Each has its own help page, listed
|
||||
# under the "Advanced-mode (SQL) commands:" section and shown by
|
||||
# `help <topic>` alongside its simple-mode sibling — so `help insert` shows
|
||||
# both the simple form and `sql_insert` (like `help create` already does).
|
||||
select: |-
|
||||
select <cols> | * from <T> [where …] [group by …] [order by …] [limit n]
|
||||
— query rows (advanced SQL)
|
||||
with: |-
|
||||
with <name> as (<select>) [, …] <select> — query through a named
|
||||
sub-query / CTE (advanced SQL)
|
||||
sql_insert: |-
|
||||
insert into <T> (col, …) values (val, …) — add a row (advanced SQL)
|
||||
sql_update: |-
|
||||
update <T> set <col> = <val>, … where <expr> — change matching rows (advanced SQL)
|
||||
sql_delete: |-
|
||||
delete from <T> where <expr> — remove matching rows (advanced SQL)
|
||||
explain_sql: |-
|
||||
explain <select|with|insert|update|delete …> — show the plan for a SQL statement,
|
||||
without running it (advanced SQL)
|
||||
# Type reference, appended after the command list.
|
||||
types_reference: |
|
||||
Types: text, int, real, decimal, bool, date, datetime, blob, serial, shortid
|
||||
|
||||
Reference in New Issue
Block a user