mirror of
https://github.com/itme-brain/nixos.git
synced 2026-03-24 08:39:42 -04:00
prompt real final
This commit is contained in:
parent
1164b15c72
commit
a6da05c09c
1 changed files with 9 additions and 0 deletions
|
|
@ -2,6 +2,7 @@
|
||||||
check_ssh() {
|
check_ssh() {
|
||||||
if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then
|
if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then
|
||||||
ssh_PS1="\n\[\033[01;37m\]\u@\h:\[\033[00m\]"
|
ssh_PS1="\n\[\033[01;37m\]\u@\h:\[\033[00m\]"
|
||||||
|
return 0
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -13,13 +14,17 @@ check_venv() {
|
||||||
if [ -n "$VIRTUAL_ENV" ]; then
|
if [ -n "$VIRTUAL_ENV" ]; then
|
||||||
local python_icon="\[\033[01;33m\] \[\033[00m\]"
|
local python_icon="\[\033[01;33m\] \[\033[00m\]"
|
||||||
venv_icons+="$python_icon"
|
venv_icons+="$python_icon"
|
||||||
|
return 0
|
||||||
fi
|
fi
|
||||||
if [ -d "''${git_root}/node_modules" ]; then
|
if [ -d "''${git_root}/node_modules" ]; then
|
||||||
local node_icon="\[\033[01;93m\] \[\033[00m\]"
|
local node_icon="\[\033[01;93m\] \[\033[00m\]"
|
||||||
venv_icons+="$node_icon"
|
venv_icons+="$node_icon"
|
||||||
|
return 0
|
||||||
fi
|
fi
|
||||||
|
return 0
|
||||||
else
|
else
|
||||||
unset venv_icons
|
unset venv_icons
|
||||||
|
return 0
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -29,8 +34,10 @@ set_git_dir() {
|
||||||
|
|
||||||
if [ "$git_curr_dir" == "." ]; then
|
if [ "$git_curr_dir" == "." ]; then
|
||||||
working_dir="\[\033[01;34m\] $git_root_dir\[\033[00m\]"
|
working_dir="\[\033[01;34m\] $git_root_dir\[\033[00m\]"
|
||||||
|
return 0
|
||||||
else
|
else
|
||||||
working_dir="\[\033[01;34m\] $git_root_dir/$git_curr_dir\[\033[00m\]"
|
working_dir="\[\033[01;34m\] $git_root_dir/$git_curr_dir\[\033[00m\]"
|
||||||
|
return 0
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -45,6 +52,7 @@ check_git() {
|
||||||
git_branch_PS1="\[\033[01;31m\]$git_branch :\[\033[00m\]"
|
git_branch_PS1="\[\033[01;31m\]$git_branch :\[\033[00m\]"
|
||||||
|
|
||||||
set_git_dir
|
set_git_dir
|
||||||
|
return 0
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -63,6 +71,7 @@ function set_prompt() {
|
||||||
check_venv
|
check_venv
|
||||||
|
|
||||||
PS1="$ssh_PS1\n$working_dir\n$venv_icons$green_arrow$git_branch_PS1$white_text"
|
PS1="$ssh_PS1\n$working_dir\n$venv_icons$green_arrow$git_branch_PS1$white_text"
|
||||||
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
PROMPT_COMMAND="set_prompt"
|
PROMPT_COMMAND="set_prompt"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue