Skip to content

docs: document PROMPT1/2/3 prompt formatting specifiers (closes #374)#578

Open
dashitongzhi wants to merge 1 commit into
xo:mainfrom
dashitongzhi:feat/docs-prompt-formatting-20260604091901
Open

docs: document PROMPT1/2/3 prompt formatting specifiers (closes #374)#578
dashitongzhi wants to merge 1 commit into
xo:mainfrom
dashitongzhi:feat/docs-prompt-formatting-20260604091901

Conversation

@dashitongzhi

Copy link
Copy Markdown

Adds a 'Prompt Formatting' section to README.md documenting the percent-escape sequences supported by usql.

The README referenced PROMPT1 in several examples (e.g. %S%M%/%R%#) but never explained the available specifiers, and usql's set deviates slightly from psql's. The new section lists every specifier actually implemented in handler/handler.go and notes where usql differs from psql.

Closes #374.

Also fixes two small doc typos along the way:

  • CONTRIBUTING.md: it's ownits own (possessive typo)
  • README.md: missing article in macOS icu4c troubleshooting note

Adds a 'Prompt Formatting' section to README.md documenting the
percent-escape sequences supported by usql (the existing examples
referenced PROMPT1 with %S%M%/%R%# etc. but never explained them).
The section lists every specifier actually implemented in
handler/handler.go and notes where usql's set deviates from psql's.

Closes xo#374.

Also fixes two small doc typos along the way:
  - CONTRIBUTING.md: "it's own" → "its own" (possessive typo)
  - README.md: missing article in macOS icu4c troubleshooting note
Copilot AI review requested due to automatic review settings June 4, 2026 01:25

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds documentation for configuring usql interactive prompt formatting and fixes minor grammar in contributor docs.

Changes:

  • Document PROMPT1/PROMPT2/PROMPT3 prompt formatting and supported % specifiers in README.md
  • Add TOC/link references for the new “Prompt Formatting” section
  • Fix “it's” → “its” in CONTRIBUTING.md

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
README.md Adds a new “Prompt Formatting” section, TOC entry, and link reference; includes specifier table and example.
CONTRIBUTING.md Fixes a grammatical typo in the autocomplete contributor guidance.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread README.md
Comment on lines +1394 to +1395
For example, to colorize the prompt green and show the user, database, and
transaction state, the following `PROMPT1` could be used:
Comment thread README.md
| `%R` | A single character reflecting the statement/connection state (eg, `-`, `*`, `'`, `"`, `$`, `(`). |
| `%[ ... %]` | Bracket a span of non-printing terminal control characters (eg, ANSI color escapes) so that line-editing width is computed correctly. |
| `%%` | A literal `%`. |
| `%0nnn` | A character with the given octal code (also accepts `%x` for hexadecimal). |
Comment thread README.md
Comment on lines +1377 to +1380
| `%u` | The `dburl` short form of the connection URL (eg, `postgres://user@host/dbname`). |
| `%M` | The full host name of the database server (with domain), or empty when not connected. |
| `%m` | The host name truncated at the first dot, or empty when not connected. |
| `%>` | The port number prefixed by `:` (eg, `:5432`), or empty if no port is set. |
Comment thread README.md
Comment on lines +1387 to +1390
| `%p` | The base name of the path component of the connection URL (eg, the SQLite database file name). |
| `%#` | A `~` when in a transaction (or batch) block, otherwise `>`. |
| `%R` | A single character reflecting the statement/connection state (eg, `-`, `*`, `'`, `"`, `$`, `(`). |
| `%[ ... %]` | Bracket a span of non-printing terminal control characters (eg, ANSI color escapes) so that line-editing width is computed correctly. |
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document Prompt Formatting

2 participants