Skip to content

Show PostgreSQL service names in the prompt - #1632

Merged
j-bennet merged 3 commits into
dbcli:mainfrom
jackwalkerlabs:feat/service-prompt-1624
Oct 15, 2026
Merged

j-bennet merged 3 commits into
dbcli:mainfrom
jackwalkerlabs:feat/service-prompt-1624

Conversation

@jackwalkerlabs

Copy link
Copy Markdown
Contributor

Add a \service prompt token for connections made with service=... or PGSERVICE. Users can set prompt = '\service> ' to show their familiar service name instead of a long hostname. Direct connections clear the token after a successful connection.

Fixes #1624.

Validation: full suite against an isolated PostgreSQL 17 instance: 2,782 passed, 1 xfailed, 1 xpassed. Tests cover explicit/environment service names, an empty token without a service, and clearing it on direct reconnect. Ruff hooks pass. Python 3.12 on macOS.

Implemented and tested using Codex under the submitting account's authorization.

Checklist

  • Added changelog entry and prompt configuration documentation.
  • Added submitting account to AUTHORS.
  • Installed pre-commit hooks.
  • Verified behavior and ran tests.
  • Please squash merge.

DiegoDAF added a commit to DiegoDAF/pgcli.daf that referenced this pull request Oct 13, 2026
@j-bennet

Copy link
Copy Markdown
Contributor

Thanks @jackwalkerlabs !

@j-bennet
j-bennet merged commit 3c3776c into dbcli:main Oct 15, 2026
7 checks passed
DiegoDAF added a commit to DiegoDAF/pgcli.daf that referenced this pull request Oct 15, 2026
diego-feito-stori pushed a commit to DiegoDAF/pgcli.daf that referenced this pull request Oct 15, 2026
diego-feito-stori pushed a commit to DiegoDAF/pgcli.daf that referenced this pull request Oct 15, 2026
Conflicts: changelog.rst (their Upcoming layout against ours; the entry
moves to our Upcoming Features) and the end of connect(), where their
`self.service_name = None` meets our SSL warning. Both kept, the reset
right after `self.pgexecute = pgexecute`; connect_service() sets the
name after our connect(**params), so the token still shows it.

service_name is annotated Optional[str]: upstream assigns None first
and mypy, which only our CI runs, rejected the later str.
diego-feito-stori pushed a commit to DiegoDAF/pgcli.daf that referenced this pull request Oct 15, 2026
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.

Feature Request: show service name in prompt

2 participants