This commit is contained in:
Jonas Forsberg 2021-11-12 12:47:28 +01:00
parent c5d16114b8
commit 727a31547c
No known key found for this signature in database
GPG Key ID: F2E9818C70350CC9
4 changed files with 8 additions and 35 deletions

1
.alias
View File

@ -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'

View File

@ -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}"

View File

@ -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

View File

@ -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