docs: document PROMPT1/2/3 prompt formatting specifiers (closes #374)#578
Open
dashitongzhi wants to merge 1 commit into
Open
docs: document PROMPT1/2/3 prompt formatting specifiers (closes #374)#578dashitongzhi wants to merge 1 commit into
dashitongzhi wants to merge 1 commit into
Conversation
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
There was a problem hiding this comment.
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/PROMPT3prompt formatting and supported%specifiers inREADME.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 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: |
| | `%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 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 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. | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 inhandler/handler.goand notes where usql differs from psql.Closes #374.
Also fixes two small doc typos along the way:
it's own→its own(possessive typo)