From 727a31547cee42150164bf95efdacded701a6720 Mon Sep 17 00:00:00 2001 From: Jonas Forsberg Date: Fri, 12 Nov 2021 12:47:28 +0100 Subject: [PATCH] . --- .alias | 1 - .functions/ps1.sh | 11 ++++++++--- .local/bin/dotfiles_gbt_status.sh | 27 --------------------------- .local/bin/todo_sh_status.sh | 4 ---- 4 files changed, 8 insertions(+), 35 deletions(-) delete mode 100755 .local/bin/dotfiles_gbt_status.sh delete mode 100755 .local/bin/todo_sh_status.sh diff --git a/.alias b/.alias index 6639bd9..dd6df23 100644 --- a/.alias +++ b/.alias @@ -3,6 +3,5 @@ alias ip='ip -color' alias weather='curl http://v2.wttr.in/Stockholm' alias gpg='gpg2' alias ls_dotfiels='/usr/bin/git --git-dir=$HOME/.dotfiles ls-tree --full-tree -r --name-only HEAD' -alias t="todo.sh" alias gl='git log --graph --pretty=format:'\''%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'\'' --abbrev-commit --date=relative' alias mariadb='kubectl exec -it $(kubectl get pod --selector=app=mariadb --template "{{range .items}}{{.metadata.name}}{{\"\n\"}}{{end}}") -- mysql' diff --git a/.functions/ps1.sh b/.functions/ps1.sh index 8fc91d1..0bee62c 100644 --- a/.functions/ps1.sh +++ b/.functions/ps1.sh @@ -6,6 +6,7 @@ function set_bash_prompt () { local PYTHON_ENV="" local K8S_CURRENT_CONTEXT="" local DOTF="" + local TODO="" local STATUS="" local COLOR_OFF='\033[0m' @@ -19,7 +20,7 @@ function set_bash_prompt () { local COLOR_EXIT_STATUS="[\033[1;37m\033[41m" local COLOR_KUBERNETES="\033[1;37m\033[44m" local COLOR_TODO="'\033[1;30m''\033[43m'" - local COLOR_DOTF="\033[1;30m\033[45m" + local COLOR_DOTF="\033[1;37m\033[45m" local CURRENT_CONTEXT="" @@ -43,8 +44,12 @@ function set_bash_prompt () { fi fi - if [[ -n $DOTF ]];then - STATUS="${COLOR_DIVIDER}[${DOTF}${COLOR_DIVIDER}]" + if [[ $(type -t todo_status) == function ]] && [[ "$(todo_status)" == "YES" ]];then + TODO="${COLOR_TODO}T" + fi + + if [[ -n $DOTF ]] || [[ -n $TODO ]];then + STATUS="${COLOR_DIVIDER}[${DOTF}${TODO}${COLOR_DIVIDER}]" fi PS1="\n${COLOR_DIVIDER}┌──(${COLOR_USERNAME}\u${COLOR_USERHOSTAT}@${COLOR_HOSTNAME}\h${COLOR_DIVIDER})─[${COLOR_PATH}\w${COLOR_DIVIDER}]${EXIT_STATUS}${STATUS}${PYTHON_ENV}${K8S_CURRENT_CONTEXT}${GIT_BRANCH}" diff --git a/.local/bin/dotfiles_gbt_status.sh b/.local/bin/dotfiles_gbt_status.sh deleted file mode 100755 index b8d94d5..0000000 --- a/.local/bin/dotfiles_gbt_status.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash -case $1 in - check_error) - result="$(/usr/bin/git --git-dir=$HOME/.dotfiles --work-tree=$HOME status --short 2> /dev/null)" - if [[ $? -ne 0 ]]; then - echo YES - fi - ;; - check_status) - result="$(/usr/bin/git --git-dir=$HOME/.dotfiles --work-tree=$HOME status --short 2> /dev/null)" - if [[ ! -z "$result" ]]; then - echo YES - fi - ;; - - check_push) - result="$(/usr/bin/git --git-dir=$HOME/.dotfiles --work-tree=$HOME status --short 2> /dev/null)" - if [[ -z "$result" ]]; then - result="$(/usr/bin/git --git-dir=$HOME/.dotfiles --work-tree=$HOME cherry -v )" - if [[ ! -z "$result" ]]; then - echo YES - fi - fi - ;; - -esac - diff --git a/.local/bin/todo_sh_status.sh b/.local/bin/todo_sh_status.sh deleted file mode 100755 index cc7ea9d..0000000 --- a/.local/bin/todo_sh_status.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -NUM="$(todo.sh lsp "$1" | sed -n 's/.*TODO: \([0-9]\+\).*/\1/p')" -[[ "$NUM" -ne 0 ]] && echo "YES" -exit 0