From baefc5c6f9e65806452aa7258825b1852959c1f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs?= Date: Tue, 17 Aug 2021 16:26:03 -0500 Subject: simply __prompt_git --- hyperterm/core/git.sh | 9 +++++++++ hyperterm/themes/default.sh | 6 +----- hyperterm/themes/joy.sh | 6 +----- hyperterm/themes/light_theme.sh | 6 +----- hyperterm/themes/minterm.sh | 6 +----- hyperterm/themes/pure.sh | 6 +----- hyperterm/themes/special.sh | 6 +----- 7 files changed, 15 insertions(+), 30 deletions(-) (limited to 'hyperterm') diff --git a/hyperterm/core/git.sh b/hyperterm/core/git.sh index 17bb575..55814dd 100644 --- a/hyperterm/core/git.sh +++ b/hyperterm/core/git.sh @@ -330,3 +330,12 @@ _prompt_get_git_info() { printf '%b%s%b' "${BOLD}${LEMON}" "git:($output" "${BOLD}${LEMON})" fi } + +__prompt_git() { + if _prompt_is_on_git &> /dev/null; then + echo -n "${BOLD}${WHITE} on $RESET" && \ + echo -n "$(_prompt_get_git_info "$@")" && \ + echo -n "${BOLD}${RED}$(_get_git_progress)" && \ + echo -n "$RESET" + fi +} diff --git a/hyperterm/themes/default.sh b/hyperterm/themes/default.sh index 24843e8..8d2f026 100644 --- a/hyperterm/themes/default.sh +++ b/hyperterm/themes/default.sh @@ -14,11 +14,7 @@ default=("\n\ \[$RESET\]\ \[${BOLD}${WHITE}\][\$PWD]\[$RESET\] \ \$(exitstatus)\[$RESET\]\ -\$( _prompt_is_on_git &> /dev/null && \ - echo -n \" \[${BOLD}${WHITE}\]on\[$RESET\] \" && \ - echo -n \"\$(_prompt_get_git_info)\" && \ - echo -n \"\[${BOLD}${RED}\]\$(_get_git_progress)\" && \ - echo -n \"\[$RESET\]\")\ +\$(__prompt_git)\ \n\[${BOLD}${GREEN}\]$SYMBOL \[$RESET\]") export default diff --git a/hyperterm/themes/joy.sh b/hyperterm/themes/joy.sh index c15700d..0f5e8ee 100644 --- a/hyperterm/themes/joy.sh +++ b/hyperterm/themes/joy.sh @@ -18,11 +18,7 @@ _colors_bash "$@" \$(exitstatus)\ \[${BOLD}${CYAN}\]\ \342\224\200\ -\$( _prompt_is_on_git &> /dev/null && \ - echo -n \"\[$RESET\]\" && \ - echo -n \"\$(_prompt_get_git_info)\" && \ - echo -n \"\[${BOLD}${RED}\]\$(_get_git_progress)\" && \ - echo -n \"\[$RESET\]\")\ +\$(__prompt_git)\ \[${BOLD}${CYAN}\]\342\224\200[\ \[${RESET}\]\t\ \[${BOLD}${CYAN}\]]\n\ diff --git a/hyperterm/themes/light_theme.sh b/hyperterm/themes/light_theme.sh index 775f5f7..c269aaa 100644 --- a/hyperterm/themes/light_theme.sh +++ b/hyperterm/themes/light_theme.sh @@ -13,11 +13,7 @@ _colors_bash "$@" \[${BOLD}${GREY}\]\h\[$RESET\] \ \$(exitstatus)\[$RESET\] \ \[${BOLD}${WHITE}\][\$PWD]\ -\$( _prompt_is_on_git &> /dev/null && \ - echo -n \" \[${BOLD}${WHITE}\]on\[$RESET\] \" && \ - echo -n \"\$(_prompt_get_git_info)\" && \ - echo -n \"\[${BOLD}${RED}\]\$(_get_git_progress)\" && \ - echo -n \"\[$RESET\]\")\ +\$(__prompt_git)\ \n\[${BOLD}${CYAN}\]╰─➤\[${BOLD}${GREEN}\]$SYMBOL \[$RESET\]}" unset _psi diff --git a/hyperterm/themes/minterm.sh b/hyperterm/themes/minterm.sh index 62e3ae7..139094a 100644 --- a/hyperterm/themes/minterm.sh +++ b/hyperterm/themes/minterm.sh @@ -12,11 +12,7 @@ _colors_bash "$@" \[${BOLD}${GREY}\]\h\[$RESET\] \ \$(exitstatus)\[$RESET\] \ \[${BOLD}${WHITE}\][\$PWD]\ -\$( _prompt_is_on_git &> /dev/null && \ - echo -n \" \[${BOLD}${WHITE}\]on\[$RESET\] \" && \ - echo -n \"\$(_prompt_get_git_info)\" && \ - echo -n \"\[${BOLD}${RED}\]\$(_get_git_progress)\" && \ - echo -n \"\[$RESET\]\")\n\ +\$(__prompt_git)\n\ \[${BOLD}${CYAN}\]╰─➤\[$RESET\] \ \$( echo -n \"\[${BOLD}${GREY}\]\$(date +%H:%M)\" )\[$RESET\] \ \[${BOLD}${GREEN}\]$SYMBOL \[$RESET\]}" diff --git a/hyperterm/themes/pure.sh b/hyperterm/themes/pure.sh index a4fbdb3..62958de 100644 --- a/hyperterm/themes/pure.sh +++ b/hyperterm/themes/pure.sh @@ -12,11 +12,7 @@ _colors_bash "$@" \[${BOLD}${YELLOW}\]]\[$RESET\] \ \$(exitstatus)\[$RESET\] \ \[${BOLD}${BLUE}\](\$(date +%H:%M:%S))\ -\$( _prompt_is_on_git &> /dev/null && \ - echo -n \" \[${BOLD}${WHITE}\]on\[$RESET\] \" && \ - echo -n \"\$(_prompt_get_git_info)\" && \ - echo -n \"\[${BOLD}${RED}\]\$(_get_git_progress)\" && \ - echo -n \"\[$RESET\]\")\ +\$(__prompt_git)\ \n\[${BOLD}${CYAN}\]$SYMBOL \[$RESET\]}" unset _psi diff --git a/hyperterm/themes/special.sh b/hyperterm/themes/special.sh index 3820573..08b2f87 100644 --- a/hyperterm/themes/special.sh +++ b/hyperterm/themes/special.sh @@ -26,11 +26,7 @@ special=("\n\ \[${BOLD}${GREY}\]\ \D{%Y-%m-%d}@\D{%I:%M%p}\[$RESET\] \ \$(exitstatus)\[$_PROMPT_RESET\]\ -\$( _prompt_is_on_git &> /dev/null && \ - echo -n \" \[${BOLD}${WHITE}\]on\[$RESET\] \" && \ - echo -n \"\$(_prompt_get_git_info)\" && \ - echo -n \"\[${BOLD}${RED}\]\$(_get_git_progress)\" && \ - echo -n \"\[$RESET\]\")\n\ +\$(__prompt_git)\n\ \[${BOLD}${GREEN}\]$SYMBOL \[$RESET\]") export special -- cgit v1.2.3