mirror of
https://github.com/dbcli/pgcli.git
synced 2024-10-26 22:29:08 +03:00
support ansi escape sequences for prompt colors
This commit is contained in:
parent
0f969aba0c
commit
36605174a4
1
AUTHORS
1
AUTHORS
@ -101,6 +101,7 @@ Contributors:
|
||||
* Sebastian Janko (sebojanko)
|
||||
* Pedro Ferrari (petobens)
|
||||
* Martin Matejek (mmtj)
|
||||
* Jonas Jelten
|
||||
|
||||
Creator:
|
||||
--------
|
||||
|
@ -4,6 +4,7 @@ Upcoming:
|
||||
Features:
|
||||
---------
|
||||
|
||||
* Add support for ANSI escape sequences for coloring the prompt (#1123).
|
||||
* Add `\\G` as a terminator to sql statements that will show the results in expanded mode. This feature is copied from mycli. (Thanks: `Amjith Ramanujam`_)
|
||||
* Removed limit prompt and added automatic row limit on queries with no LIMIT clause (#1079) (Thanks: `Sebastian Janko`_)
|
||||
* Function argument completions now take account of table aliases (#1048). (Thanks: `Owen Stephens`_)
|
||||
|
@ -36,6 +36,7 @@ from prompt_toolkit.enums import DEFAULT_BUFFER, EditingMode
|
||||
from prompt_toolkit.shortcuts import PromptSession, CompleteStyle
|
||||
from prompt_toolkit.document import Document
|
||||
from prompt_toolkit.filters import HasFocus, IsDone
|
||||
from prompt_toolkit.formatted_text import ANSI
|
||||
from prompt_toolkit.lexers import PygmentsLexer
|
||||
from prompt_toolkit.layout.processors import (
|
||||
ConditionalProcessor,
|
||||
@ -776,7 +777,8 @@ class PGCli(object):
|
||||
):
|
||||
prompt = self.get_prompt("\\d> ")
|
||||
|
||||
return [("class:prompt", prompt)]
|
||||
prompt = prompt.replace("\\x1b", "\x1b")
|
||||
return ANSI(prompt)
|
||||
|
||||
def get_continuation(width, line_number, is_soft_wrap):
|
||||
continuation = self.multiline_continuation_char * (width - 1) + " "
|
||||
|
@ -126,6 +126,7 @@ less_chatty = False
|
||||
# \# - "@" sign if logged in as superuser, '>' in other case
|
||||
# \n - Newline
|
||||
# \dsn_alias - name of dsn alias if -D option is used (empty otherwise)
|
||||
# \x1b[...m - insert ANSI escape sequence
|
||||
prompt = '\u@\h:\d> '
|
||||
|
||||
# Number of lines to reserve for the suggestion menu
|
||||
|
Loading…
Reference in New Issue
Block a user