mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 08:24:40 +01:00
prompt: yellow env_name (#5457)
### Motivation When interact with default prompt I noticed that`env_name` has no color and when you type command or see the output it mix with `env_name` visually. Prompt is not highlighted when `env_name` has default color. ### Before Output and env_name are visually mixed: <img width="900" alt="image" src="https://github.com/xonsh/xonsh/assets/1708680/c843388e-6e72-4fba-ab0f-6cd3fb023cd2"> ### After Output and env_name are visually distinct: <img width="918" alt="image" src="https://github.com/xonsh/xonsh/assets/1708680/09f45cd8-63d1-479a-bfab-c8063cf03aeb"> ## For community ⬇️ **Please click the 👍 reaction instead of leaving a `+1` or 👍 comment** --------- Co-authored-by: a <1@1.1> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
1f960b2a8d
commit
1feab91935
3 changed files with 27 additions and 4 deletions
23
news/prompt_env_name_yel.rst
Normal file
23
news/prompt_env_name_yel.rst
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
**Added:**
|
||||||
|
|
||||||
|
* <news item>
|
||||||
|
|
||||||
|
**Changed:**
|
||||||
|
|
||||||
|
* Prompt: ``env_name`` will have yellow color by default.
|
||||||
|
|
||||||
|
**Deprecated:**
|
||||||
|
|
||||||
|
* <news item>
|
||||||
|
|
||||||
|
**Removed:**
|
||||||
|
|
||||||
|
* <news item>
|
||||||
|
|
||||||
|
**Fixed:**
|
||||||
|
|
||||||
|
* <news item>
|
||||||
|
|
||||||
|
**Security:**
|
||||||
|
|
||||||
|
* <news item>
|
|
@ -169,7 +169,7 @@ class Aliases(cabc.MutableMapping):
|
||||||
# only once.
|
# only once.
|
||||||
if (
|
if (
|
||||||
isinstance(value, cabc.Iterable)
|
isinstance(value, cabc.Iterable)
|
||||||
and hasattr(value, '__len__')
|
and hasattr(value, "__len__")
|
||||||
and len(value) > 1
|
and len(value) > 1
|
||||||
and (isinstance(mod := self._raw.get(str(value[0])), SpecModifierAlias))
|
and (isinstance(mod := self._raw.get(str(value[0])), SpecModifierAlias))
|
||||||
):
|
):
|
||||||
|
|
|
@ -142,20 +142,20 @@ def default_prompt():
|
||||||
"""Creates a new instance of the default prompt."""
|
"""Creates a new instance of the default prompt."""
|
||||||
if xp.ON_CYGWIN or xp.ON_MSYS:
|
if xp.ON_CYGWIN or xp.ON_MSYS:
|
||||||
dp = (
|
dp = (
|
||||||
"{env_name}"
|
"{YELLOW}{env_name}{RESET}"
|
||||||
"{BOLD_GREEN}{user}@{hostname}"
|
"{BOLD_GREEN}{user}@{hostname}"
|
||||||
"{BOLD_BLUE} {cwd} {prompt_end}{RESET} "
|
"{BOLD_BLUE} {cwd} {prompt_end}{RESET} "
|
||||||
)
|
)
|
||||||
elif xp.ON_WINDOWS and not xp.win_ansi_support():
|
elif xp.ON_WINDOWS and not xp.win_ansi_support():
|
||||||
dp = (
|
dp = (
|
||||||
"{env_name}"
|
"{YELLOW}{env_name}{RESET}"
|
||||||
"{BOLD_INTENSE_GREEN}{user}@{hostname}{BOLD_INTENSE_CYAN} "
|
"{BOLD_INTENSE_GREEN}{user}@{hostname}{BOLD_INTENSE_CYAN} "
|
||||||
"{cwd}{branch_color}{curr_branch: {}}{RESET} "
|
"{cwd}{branch_color}{curr_branch: {}}{RESET} "
|
||||||
"{BOLD_INTENSE_CYAN}{prompt_end}{RESET} "
|
"{BOLD_INTENSE_CYAN}{prompt_end}{RESET} "
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
dp = (
|
dp = (
|
||||||
"{env_name}"
|
"{YELLOW}{env_name}{RESET}"
|
||||||
"{BOLD_GREEN}{user}@{hostname}{BOLD_BLUE} "
|
"{BOLD_GREEN}{user}@{hostname}{BOLD_BLUE} "
|
||||||
"{cwd}{branch_color}{curr_branch: {}}{RESET} "
|
"{cwd}{branch_color}{curr_branch: {}}{RESET} "
|
||||||
"{RED}{last_return_code_if_nonzero:[{BOLD_INTENSE_RED}{}{RED}] }{RESET}"
|
"{RED}{last_return_code_if_nonzero:[{BOLD_INTENSE_RED}{}{RED}] }{RESET}"
|
||||||
|
|
Loading…
Add table
Reference in a new issue