bash prompt

This commit is contained in:
Bryan Ramos 2024-05-11 14:09:57 -04:00
parent e1ae304487
commit 24401dfd63
Signed by: bryan
GPG key ID: 6ABDCD144D6643C8
3 changed files with 18 additions and 5 deletions

View file

@ -1,2 +0,0 @@
''
''

View file

@ -1,3 +1,10 @@
{ config, lib, ... }:
with lib;
let
git = config.modules.user.git;
in
''
check_ssh() {
if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then
@ -6,6 +13,7 @@ check_ssh() {
fi
}
${optionalString git.enable ''
add_icon() {
local icon=$1
if [[ ! $venv_icons =~ $icon ]]; then
@ -82,6 +90,7 @@ check_project() {
return 0
fi
}
''}
function set_prompt() {
local green_arrow="\[\033[01;32m\]>> "
@ -89,13 +98,20 @@ function set_prompt() {
local working_dir="\[\033[01;34m\]\w\[\033[00m\]"
local ssh_PS1
check_ssh
${optionalString git.enable ''
local venv_icons
local git_branch_PS1
check_ssh
check_project
''}
PS1="$ssh_PS1\n$working_dir$green_arrow$white_text"
${optionalString git.enable ''
PS1="$ssh_PS1\n$working_dir\n$venv_icons$green_arrow$git_branch_PS1$white_text"
''}
return 0
}