mirror of
https://github.com/itme-brain/nixos.git
synced 2026-03-24 00:29:43 -04:00
venv check
This commit is contained in:
parent
c88747323e
commit
d962c4a001
1 changed files with 7 additions and 2 deletions
|
|
@ -12,6 +12,7 @@ is_ssh_session() {
|
||||||
function set_ps1_prompt() {
|
function set_ps1_prompt() {
|
||||||
local git_branch=""
|
local git_branch=""
|
||||||
local flake_icon=""
|
local flake_icon=""
|
||||||
|
local python_icon=""
|
||||||
local cur_dir=""
|
local cur_dir=""
|
||||||
|
|
||||||
if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
|
if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
|
||||||
|
|
@ -40,11 +41,15 @@ function set_ps1_prompt() {
|
||||||
cur_dir="\[\033[01;34m\]\w\[\033[00m\]"
|
cur_dir="\[\033[01;34m\]\w\[\033[00m\]"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ -n "$VIRTUAL_ENV" ]]; then
|
||||||
|
python_icon="\[\033[01;33m\] \[\033[00m\]"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -n "''${IN_NIX_SHELL:+x}" ]; then
|
if [ -n "''${IN_NIX_SHELL:+x}" ]; then
|
||||||
PS1="$cur_dir\n$flake_icon\[\033[01;32m\]nixShell>$git_branch\[\033[00m\]"
|
PS1="$cur_dir\n$flake_icon$python_icon\[\033[01;32m\]nixShell>$git_branch\[\033[00m\]"
|
||||||
else
|
else
|
||||||
if ! is_ssh_session; then
|
if ! is_ssh_session; then
|
||||||
PS1="\n$cur_dir\n$flake_icon\[\033[01;32m\]>$git_branch\[\033[00m\]"
|
PS1="\n$cur_dir\n$flake_icon$python_icon\[\033[01;32m\]>$git_branch\[\033[00m\]"
|
||||||
else
|
else
|
||||||
PS1="\n\[\033[01;34m\]\w\[\033[00m\]\n\[\033[01;32m\]\u@\h:\[\033[00m\] "
|
PS1="\n\[\033[01;34m\]\w\[\033[00m\]\n\[\033[01;32m\]\u@\h:\[\033[00m\] "
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue