prompt-toolkit / prompt-toolkit/python-prompt-toolkit
Customizable prompt with various tokens
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 10.6k
- Forks
- 815
- PR merge metrics
- No merged PRs in 30d
Description
The request is to create beautiful prompts to have an ability to customize prompt string with extendable list of parameters and coloring.
For some programs like iPython or ptpython users usually don't require something very specific like time or database or path, but users for other applications like mycli or pgcli usually require some parameters specified in the prompt.
It's fine when you able to specify coloring for whole line if it's short or isn't informative. But if you in mycli/pgcli add date, user, host and a database, I'd like to have whole line be colored as I do it in my shell.
Simplified version of my PS1 setup in my .zshrc (without custom VCS calls) looks like on picture and a script below (database is a plain string).
I'd like to have the the same simple mechanism to specify variables and custom colors for them. This library able to color complex syntax while input and it seems to be capable to handle such prompt configuration as well.
This includes rprompt parameter too, but for me the priority is the prompt string itself.

autoload colors
colors
export PS1="[%{%F{165}%}%D %{%F{226}%}%*%{$reset_color%}] %{%F{214}%}%U%n%u%{$reset_color%}@%{%F{46}%}%M%{$reset_color%} (%{${fg_bold[yellow]}%}database%{$reset_color%})> "
Short info on format script above:
%Fis color from a table%Dis a date in formatyy-mm-dd(18-09-06)%D{%C-%D}with custom specify strftime format if I'm not satisfied with defaults%*is time in usual format14:41:14%nis user%Mis hostname- database is
mycli/pgclispecific token and written here as a plain word %{...%}keeps shell sane in terms and used for prompt length calculations
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the library's prompt and rprompt configuration entry points. Compare the requested date, time, user, host, database, token, and per-token coloring behavior with the existing prompt API, then define tests that demonstrate configurable values, colors, and prompt-length handling.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, zsh
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100