lots of updates from old repo

This commit is contained in:
Steffen Vogel 2021-08-26 10:40:51 +02:00
parent 30a9c3419b
commit 80ca9ae189
15 changed files with 225 additions and 147 deletions

View file

@ -1,3 +1,17 @@
# enable color support of ls and also add handy aliases
if hash dircolors 2>/dev/null; then
if [ -r ~/.dircolors ]; then
eval "$(dircolors -b ~/.dircolors)"
else
eval "$(dircolors -b)"
fi
alias ls='ls --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
# some more ls aliases # some more ls aliases
alias ll='ls -l' alias ll='ls -l'
alias la='ls -A' alias la='ls -A'
@ -24,7 +38,10 @@ alias e=$EDITOR
alias h=helm alias h=helm
alias d=docker alias d=docker
alias r=rancher alias r=rancher
alias n="c ~/workspace/notes" alias n="code ~/workspace/notes"
alias vi=vim
alias nano=vim
# Some shortcuts for me # Some shortcuts for me
function jumphost() { function jumphost() {
@ -81,24 +98,43 @@ function rdp() {
fi fi
} }
function aws() {
local PASS=$(pass providers/aws)
local AWS=$(which aws)
# Start original aws executable with short-lived keys
AWS_ACCESS_KEY_ID=$(sed -En 's/^Access-Key: (.*)/\1/p' <<< "$PASS") \
AWS_SECRET_ACCESS_KEY=$(sed -En 's/^Secret-Key: (.*)/\1/p' <<< "$PASS") \
$AWS $@
}
function restic() { function restic() {
local RESTIC=$(which restic) local RESTIC=$(which restic)
# Start original restic executable with short-lived keys # Start original restic executable with short-lived keys
AWS_ACCESS_KEY_ID=restic \ (
AWS_SECRET_ACCESS_KEY=$(pass s3/minio-restic | head -n1) \ export RESTIC_PASSWORD="$(pass restic/macbook)"
RESTIC_PASSWORD="$(pass restic/macbook | head -n1)" \ s3 minio-restic
$RESTIC $@
$RESTIC $@
)
}
function backup() {
restic backup --exclude-if-present .resticignore ~
}
# Load S3 credentials from password-store
function s3() {
if [ "${AWS_ACCESS_KEY_PASS}" == $1 ]; then
return
fi
OUT=$(pass s3/$1)
AWS_SECRET_ACCESS_KEY=$(sed -n 1p <<< ${OUT})
AWS_ACCESS_KEY_ID=$(sed -En 's/^User: (.*)/\1/p' <<< ${OUT})
AWS_ACCESS_KEY_PASS=$1
export AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY
}
function backup-phone() {
pushd ~/annex/
git annex sync --no-push --content android
popd
} }
function oath() { function oath() {

View file

@ -2,41 +2,21 @@ if [ -f /usr/share/bash-completion/bash_completion ]; then
source /usr/share/bash-completion/bash_completion source /usr/share/bash-completion/bash_completion
fi fi
# Homebrew completions for FILE in ~/.bash_completion.d/*; do
if command -v brew > /dev/null; then source ${FILE}
HOMEBREW_PREFIX=$(brew --prefix) done
if type brew &>/dev/null; then
for COMPLETION in "$HOMEBREW_PREFIX"/etc/bash_completion.d/*; do
[[ -f $COMPLETION ]] && source "$COMPLETION"
done
if [[ -f ${HOMEBREW_PREFIX}/etc/profile.d/bash_completion.sh ]]; then
source "${HOMEBREW_PREFIX}/etc/profile.d/bash_completion.sh"
fi
fi
fi
# Add completion to aliases # Add completion to aliases
# See: https://github.com/cykerway/complete-alias # See: https://github.com/cykerway/complete-alias
source ~/.homesick/repos/complete-alias/complete_alias source ~/.homesick/repos/complete-alias/complete_alias
complete -F _complete_alias "${!BASH_ALIASES[@]}" complete -F _complete_alias "${!BASH_ALIASES[@]}"
if type brew > /dev/null 2>&1; then
HOMEBREW_PREFIX=$(brew --prefix)
for COMPLETION in "$HOMEBREW_PREFIX"/etc/bash_completion.d/*; do
[[ -f $COMPLETION ]] && source "$COMPLETION"
done
if [[ -f ${HOMEBREW_PREFIX}/etc/profile.d/bash_completion.sh ]]; then
source "${HOMEBREW_PREFIX}/etc/profile.d/bash_completion.sh"
fi
fi
# Update complations if old # Update complations if outdated
MAX_AGE=$(( 3 * 24 * 60 )) # Minutes MAX_AGE=$(( 3*24*60*60 )) # Seconds
if (( $(find "${HOME}/.bash_completion.d/generated" -mmin +${MAX_AGE} | wc -l) > 0 )) || [ -n "${UPDATE_COMPLETIONS}" ]; then GENERATED=~/.bash_completion.d/generated
echo "Start update of completions"
. ~/.homesick/repos/dotfiles/update-completions.sh if (( $(date +%s) - $(date +%s -r "${GENERATED}") > ${MAX_AGE} )) || [ -n "${UPDATE_COMPLETIONS}" ]; then
echo "Start updating of completions..."
. ~/.homesick/repos/dotfiles/update-completions.sh ${GENERATED}
echo "Completions updated" echo "Completions updated"
fi fi
for F in ~/.bash_completion.d/*; do
source $F
done

View file

@ -1,3 +0,0 @@
for COMPLETION in /Applications/Docker.app/Contents/Resources/etc/*.bash-completion; do
[ -f ${COMPLETION} ] && source ${COMPLETION}
done

View file

@ -0,0 +1,3 @@
if type doctl > /dev/null 2>&1; then
source <(doctl completion bash)
fi

View file

@ -0,0 +1,3 @@
if type helm > /dev/null 2>&1; then
source <(helm completion bash)
fi

View file

@ -0,0 +1,3 @@
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
fi

View file

@ -0,0 +1,3 @@
if type doctl > /dev/null 2>&1; then
source <(doctl completion bash)
fi

View file

@ -0,0 +1,10 @@
function _oath_completion() {
if [ -n "$2" ]; then
WORD=$2
mapfile -t COMPREPLY < <(grep -i $2 ~/.oath_tokens)
else
mapfile -t COMPREPLY < ~/.oath_tokens
fi
}
complete -F _oath_completion oath

13
home/.bash_completion.d/ykman Normal file → Executable file
View file

@ -7,17 +7,6 @@ if type ykman > /dev/null 2>&1; then
_YKMAN_COMPLETE=complete $1 ) ) _YKMAN_COMPLETE=complete $1 ) )
return 0 return 0
} }
complete -F _ykman_completion ykman
_ykman_completionetup() {
local COMPLETION_OPTIONS=""
local BASH_VERSION_ARR=(${BASH_VERSION//./ })
# Only BASH version 4.4 and later have the nosort option.
if [ ${BASH_VERSION_ARR[0]} -gt 4 ] || ([ ${BASH_VERSION_ARR[0]} -eq 4 ] && [ ${BASH_VERSION_ARR[1]} -ge 4 ]); then
COMPLETION_OPTIONS="-o nosort"
fi
complete $COMPLETION_OPTIONS -F _ykman_completion ykman
}
_ykman_completionetup;
fi fi

View file

@ -12,7 +12,7 @@ if [ -d /var/lib/snapd/snap/bin/code ]; then
export PATH="/var/lib/snapd/snap/bin/code:${PATH}" export PATH="/var/lib/snapd/snap/bin/code:${PATH}"
fi fi
if [ -d ${KREW_ROOT:-$HOME/.krew}/bin ]; then if [ -d ${KREW_ROOT:-${HOME}/.krew}/bin ]; then
PATH="${KREW_ROOT:-${HOME}/.krew}/bin:${PATH}" PATH="${KREW_ROOT:-${HOME}/.krew}/bin:${PATH}"
fi fi
@ -34,6 +34,8 @@ fi
source ${HOME}/.cargo/env source ${HOME}/.cargo/env
# OS X stuff if availabe
if type brew > /dev/null 2>&1; then if type brew > /dev/null 2>&1; then
#eval $(brew shellenv) #eval $(brew shellenv)
#export PATH="$(brew --prefix coreutils)/libexec/gnubin:${PATH}" #export PATH="$(brew --prefix coreutils)/libexec/gnubin:${PATH}"
@ -48,8 +50,6 @@ if type brew > /dev/null 2>&1; then
export PATH="/usr/local/opt/coreutils/libexec/gnubin:${PATH}" export PATH="/usr/local/opt/coreutils/libexec/gnubin:${PATH}"
fi fi
# OS X stuff if availabe
# MacGPG2 # MacGPG2
if [ -d /usr/local/MacGPG2/bin/ ]; then if [ -d /usr/local/MacGPG2/bin/ ]; then
export PATH=/usr/local/MacGPG2/bin/:$PATH export PATH=/usr/local/MacGPG2/bin/:$PATH

View file

@ -66,6 +66,19 @@
# git always compare HEAD to @{upstream} # git always compare HEAD to @{upstream}
# svn always compare HEAD to your SVN upstream # svn always compare HEAD to your SVN upstream
# #
# You can change the separator between the branch name and the above
# state symbols by setting GIT_PS1_STATESEPARATOR. The default separator
# is SP.
#
# When there is an in-progress operation such as a merge, rebase,
# revert, cherry-pick, or bisect, the prompt will include information
# related to the operation, often in the form "|<OPERATION-NAME>".
#
# When the repository has a sparse-checkout, a notification of the form
# "|SPARSE" will be included in the prompt. This can be shortened to a
# single '?' character by setting GIT_PS1_COMPRESSSPARSESTATE, or omitted
# by setting GIT_PS1_OMITSPARSESTATE.
#
# By default, __git_ps1 will compare HEAD to your SVN upstream if it can # By default, __git_ps1 will compare HEAD to your SVN upstream if it can
# find one, or @{upstream} otherwise. Once you have set # find one, or @{upstream} otherwise. Once you have set
# GIT_PS1_SHOWUPSTREAM, you can override it on a per-repository basis by # GIT_PS1_SHOWUPSTREAM, you can override it on a per-repository basis by
@ -78,12 +91,19 @@
# contains relative to newer annotated tag (v1.6.3.2~35) # contains relative to newer annotated tag (v1.6.3.2~35)
# branch relative to newer tag or branch (master~4) # branch relative to newer tag or branch (master~4)
# describe relative to older annotated tag (v1.6.3.1-13-gdd42c2f) # describe relative to older annotated tag (v1.6.3.1-13-gdd42c2f)
# tag relative to any older tag (v1.6.3.1-13-gdd42c2f)
# default exactly matching tag # default exactly matching tag
# #
# If you would like a colored hint about the current dirty state, set # If you would like a colored hint about the current dirty state, set
# GIT_PS1_SHOWCOLORHINTS to a nonempty value. The colors are based on # GIT_PS1_SHOWCOLORHINTS to a nonempty value. The colors are based on
# the colored output of "git status -sb" and are available only when # the colored output of "git status -sb" and are available only when
# using __git_ps1 for PROMPT_COMMAND or precmd. # using __git_ps1 for PROMPT_COMMAND or precmd in Bash,
# but always available in Zsh.
#
# If you would like __git_ps1 to do nothing in the case when the current
# directory is set up to be ignored by git, then set
# GIT_PS1_HIDE_IF_PWD_IGNORED to a nonempty value. Override this on the
# repository level by setting bash.hideIfPwdIgnored to "false".
# check whether printf supports -v # check whether printf supports -v
__git_printf_supports_v= __git_printf_supports_v=
@ -118,6 +138,7 @@ __git_ps1_show_upstream ()
done <<< "$output" done <<< "$output"
# parse configuration values # parse configuration values
local option
for option in ${GIT_PS1_SHOWUPSTREAM}; do for option in ${GIT_PS1_SHOWUPSTREAM}; do
case "$option" in case "$option" in
git|svn) upstream="$option" ;; git|svn) upstream="$option" ;;
@ -268,11 +289,43 @@ __git_ps1_colorize_gitstring ()
r="$c_clear$r" r="$c_clear$r"
} }
# Helper function to read the first line of a file into a variable.
# __git_eread requires 2 arguments, the file path and the name of the
# variable, in that order.
__git_eread () __git_eread ()
{ {
local f="$1" test -r "$1" && IFS=$'\r\n' read "$2" <"$1"
shift }
test -r "$f" && read "$@" <"$f"
# see if a cherry-pick or revert is in progress, if the user has committed a
# conflict resolution with 'git commit' in the middle of a sequence of picks or
# reverts then CHERRY_PICK_HEAD/REVERT_HEAD will not exist so we have to read
# the todo file.
__git_sequencer_status ()
{
local todo
if test -f "$g/CHERRY_PICK_HEAD"
then
r="|CHERRY-PICKING"
return 0;
elif test -f "$g/REVERT_HEAD"
then
r="|REVERTING"
return 0;
elif __git_eread "$g/sequencer/todo" todo
then
case "$todo" in
p[\ \ ]|pick[\ \ ]*)
r="|CHERRY-PICKING"
return 0
;;
revert[\ \ ]*)
r="|REVERTING"
return 0
;;
esac
fi
return 1
} }
# __git_ps1 accepts 0 or 1 arguments (i.e., format string) # __git_ps1 accepts 0 or 1 arguments (i.e., format string)
@ -288,6 +341,8 @@ __git_eread ()
# In this mode you can request colored hints using GIT_PS1_SHOWCOLORHINTS=true # In this mode you can request colored hints using GIT_PS1_SHOWCOLORHINTS=true
__git_ps1 () __git_ps1 ()
{ {
# preserve exit status
local exit=$?
local pcmode=no local pcmode=no
local detached=no local detached=no
local ps1pc_start='\u@\h:\w ' local ps1pc_start='\u@\h:\w '
@ -299,10 +354,14 @@ __git_ps1 ()
ps1pc_start="$1" ps1pc_start="$1"
ps1pc_end="$2" ps1pc_end="$2"
printf_format="${3:-$printf_format}" printf_format="${3:-$printf_format}"
# set PS1 to a plain prompt so that we can
# simply return early if the prompt should not
# be decorated
PS1="$ps1pc_start$ps1pc_end"
;; ;;
0|1) printf_format="${1:-$printf_format}" 0|1) printf_format="${1:-$printf_format}"
;; ;;
*) return *) return $exit
;; ;;
esac esac
@ -340,8 +399,8 @@ __git_ps1 ()
# incorrect.) # incorrect.)
# #
local ps1_expanded=yes local ps1_expanded=yes
[ -z "$ZSH_VERSION" ] || [[ -o PROMPT_SUBST ]] || ps1_expanded=no [ -z "${ZSH_VERSION-}" ] || [[ -o PROMPT_SUBST ]] || ps1_expanded=no
[ -z "$BASH_VERSION" ] || shopt -q promptvars || ps1_expanded=no [ -z "${BASH_VERSION-}" ] || shopt -q promptvars || ps1_expanded=no
local repo_info rev_parse_exit_code local repo_info rev_parse_exit_code
repo_info="$(git rev-parse --git-dir --is-inside-git-dir \ repo_info="$(git rev-parse --git-dir --is-inside-git-dir \
@ -350,14 +409,10 @@ __git_ps1 ()
rev_parse_exit_code="$?" rev_parse_exit_code="$?"
if [ -z "$repo_info" ]; then if [ -z "$repo_info" ]; then
if [ $pcmode = yes ]; then return $exit
#In PC mode PS1 always needs to be set
PS1="$ps1pc_start$ps1pc_end"
fi
return
fi fi
local short_sha local short_sha=""
if [ "$rev_parse_exit_code" = "0" ]; then if [ "$rev_parse_exit_code" = "0" ]; then
short_sha="${repo_info##*$'\n'}" short_sha="${repo_info##*$'\n'}"
repo_info="${repo_info%$'\n'*}" repo_info="${repo_info%$'\n'*}"
@ -369,6 +424,21 @@ __git_ps1 ()
local inside_gitdir="${repo_info##*$'\n'}" local inside_gitdir="${repo_info##*$'\n'}"
local g="${repo_info%$'\n'*}" local g="${repo_info%$'\n'*}"
if [ "true" = "$inside_worktree" ] &&
[ -n "${GIT_PS1_HIDE_IF_PWD_IGNORED-}" ] &&
[ "$(git config --bool bash.hideIfPwdIgnored)" != "false" ] &&
git check-ignore -q .
then
return $exit
fi
local sparse=""
if [ -z "${GIT_PS1_COMPRESSSPARSESTATE}" ] &&
[ -z "${GIT_PS1_OMITSPARSESTATE}" ] &&
[ "$(git config --bool core.sparseCheckout)" = "true" ]; then
sparse="|SPARSE"
fi
local r="" local r=""
local b="" local b=""
local step="" local step=""
@ -377,11 +447,7 @@ __git_ps1 ()
__git_eread "$g/rebase-merge/head-name" b __git_eread "$g/rebase-merge/head-name" b
__git_eread "$g/rebase-merge/msgnum" step __git_eread "$g/rebase-merge/msgnum" step
__git_eread "$g/rebase-merge/end" total __git_eread "$g/rebase-merge/end" total
if [ -f "$g/rebase-merge/interactive" ]; then r="|REBASE"
r="|REBASE-i"
else
r="|REBASE-m"
fi
else else
if [ -d "$g/rebase-apply" ]; then if [ -d "$g/rebase-apply" ]; then
__git_eread "$g/rebase-apply/next" step __git_eread "$g/rebase-apply/next" step
@ -396,10 +462,8 @@ __git_ps1 ()
fi fi
elif [ -f "$g/MERGE_HEAD" ]; then elif [ -f "$g/MERGE_HEAD" ]; then
r="|MERGING" r="|MERGING"
elif [ -f "$g/CHERRY_PICK_HEAD" ]; then elif __git_sequencer_status; then
r="|CHERRY-PICKING" :
elif [ -f "$g/REVERT_HEAD" ]; then
r="|REVERTING"
elif [ -f "$g/BISECT_LOG" ]; then elif [ -f "$g/BISECT_LOG" ]; then
r="|BISECTING" r="|BISECTING"
fi fi
@ -412,10 +476,7 @@ __git_ps1 ()
else else
local head="" local head=""
if ! __git_eread "$g/HEAD" head; then if ! __git_eread "$g/HEAD" head; then
if [ $pcmode = yes ]; then return $exit
PS1="$ps1pc_start$ps1pc_end"
fi
return
fi fi
# is it a symbolic ref? # is it a symbolic ref?
b="${head#ref: }" b="${head#ref: }"
@ -427,6 +488,8 @@ __git_ps1 ()
git describe --contains HEAD ;; git describe --contains HEAD ;;
(branch) (branch)
git describe --contains --all HEAD ;; git describe --contains --all HEAD ;;
(tag)
git describe --tags HEAD ;;
(describe) (describe)
git describe HEAD ;; git describe HEAD ;;
(* | default) (* | default)
@ -447,6 +510,7 @@ __git_ps1 ()
local i="" local i=""
local s="" local s=""
local u="" local u=""
local h=""
local c="" local c=""
local p="" local p=""
@ -460,10 +524,9 @@ __git_ps1 ()
if [ -n "${GIT_PS1_SHOWDIRTYSTATE-}" ] && if [ -n "${GIT_PS1_SHOWDIRTYSTATE-}" ] &&
[ "$(git config --bool bash.showDirtyState)" != "false" ] [ "$(git config --bool bash.showDirtyState)" != "false" ]
then then
git diff --no-ext-diff --quiet --exit-code || w="*" git diff --no-ext-diff --quiet || w="*"
if [ -n "$short_sha" ]; then git diff --no-ext-diff --cached --quiet || i="+"
git diff-index --cached --quiet HEAD -- || i="+" if [ -z "$short_sha" ] && [ -z "$i" ]; then
else
i="#" i="#"
fi fi
fi fi
@ -475,11 +538,16 @@ __git_ps1 ()
if [ -n "${GIT_PS1_SHOWUNTRACKEDFILES-}" ] && if [ -n "${GIT_PS1_SHOWUNTRACKEDFILES-}" ] &&
[ "$(git config --bool bash.showUntrackedFiles)" != "false" ] && [ "$(git config --bool bash.showUntrackedFiles)" != "false" ] &&
git ls-files --others --exclude-standard --error-unmatch -- '*' >/dev/null 2>/dev/null git ls-files --others --exclude-standard --directory --no-empty-directory --error-unmatch -- ':/*' >/dev/null 2>/dev/null
then then
u="%${ZSH_VERSION+%}" u="%${ZSH_VERSION+%}"
fi fi
if [ -n "${GIT_PS1_COMPRESSSPARSESTATE}" ] &&
[ "$(git config --bool core.sparseCheckout)" = "true" ]; then
h="?"
fi
if [ -n "${GIT_PS1_SHOWUPSTREAM-}" ]; then if [ -n "${GIT_PS1_SHOWUPSTREAM-}" ]; then
__git_ps1_show_upstream __git_ps1_show_upstream
fi fi
@ -487,9 +555,11 @@ __git_ps1 ()
local z="${GIT_PS1_STATESEPARATOR-" "}" local z="${GIT_PS1_STATESEPARATOR-" "}"
# NO color option unless in PROMPT_COMMAND mode # NO color option unless in PROMPT_COMMAND mode or it's Zsh
if [ $pcmode = yes ] && [ -n "${GIT_PS1_SHOWCOLORHINTS-}" ]; then if [ -n "${GIT_PS1_SHOWCOLORHINTS-}" ]; then
__git_ps1_colorize_gitstring if [ $pcmode = yes ] || [ -n "${ZSH_VERSION-}" ]; then
__git_ps1_colorize_gitstring
fi
fi fi
b=${b##refs/heads/} b=${b##refs/heads/}
@ -498,8 +568,8 @@ __git_ps1 ()
b="\${__git_ps1_branch_name}" b="\${__git_ps1_branch_name}"
fi fi
local f="$w$i$s$u" local f="$h$w$i$s$u"
local gitstring="$c$b${f:+$z$f}$r$p" local gitstring="$c$b${f:+$z$f}${sparse}$r$p"
if [ $pcmode = yes ]; then if [ $pcmode = yes ]; then
if [ "${__git_printf_supports_v-}" != yes ]; then if [ "${__git_printf_supports_v-}" != yes ]; then
@ -511,4 +581,6 @@ __git_ps1 ()
else else
printf -- "$printf_format" "$gitstring" printf -- "$printf_format" "$gitstring"
fi fi
return $exit
} }

View file

@ -1,3 +1,7 @@
if [ -f "$HOME/.bashrc" ]; then if [ -f "${HOME}/.bashrc" ]; then
source "$HOME/.bashrc" source "${HOME}/.bashrc"
fi
if [ -f "${HOME}/.iterm2_shell_integration.bash" ]; then
source "${HOME}/.iterm2_shell_integration.bash"
fi fi

View file

@ -20,23 +20,17 @@ function show_prompt {
local EXIT="$?" local EXIT="$?"
# Time # Time
local pre='\[\e[01;35m\]\A ' local pre='\[\e[01;35m\]\t '
local post local post
# Check last return value # Check last return value
if [ $EXIT != 0 ]; then if [ $EXIT != 0 ]; then
pre+='\[\e[31m\]' pre+='\[\e[31m\]'
else else
pre+='\[\e[32m\]' pre+='\[\e[32m\]'
fi fi
case "$TERM" in pre+=' \[\e[;37m\]\j \l '
xterm*|rxvt*)
echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"
;;
*)
;;
esac
# Test if root # Test if root
if [ $EUID -ne 0 ]; then if [ $EUID -ne 0 ]; then
@ -47,7 +41,11 @@ function show_prompt {
post='\[\e[01;33m\]\w' post='\[\e[01;33m\]\w'
fi fi
post+='\n \[\e[01;30m\]\# \[\e[31m\]\$ \[\e[00m\]' post+='\[\e[;37m\]\n \[\e[01;30m\]\# \[\e[31m\]\$ \[\e[00m\]'
__git_ps1 "$pre " "$post" '\[\e[01;30m\](%s\[\e[01;30m\]) ' if [[ $(git config --default true --get prompt.show) == "false" ]]; then
PS1="$pre $post"
else
__git_ps1 "$pre " "$post" '\[\e[01;30m\](%s\[\e[01;30m\]) '
fi
} }

View file

@ -12,6 +12,9 @@ shopt -s globstar
# append to the history file, don't overwrite it # append to the history file, don't overwrite it
shopt -s histappend shopt -s histappend
# Auto "cd" when entering just a path
shopt -s autocd
# don't put duplicate lines or lines starting with space in the history. # don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options # See bash(1) for more options
HISTCONTROL=ignorespace:ignoredups:erasedups HISTCONTROL=ignorespace:ignoredups:erasedups
@ -20,7 +23,7 @@ HISTCONTROL=ignorespace:ignoredups:erasedups
HISTSIZE=99999999 HISTSIZE=99999999
HISTFILESIZE=99999999 HISTFILESIZE=99999999
HOSTFILE=$HOME/.hosts HOSTFILE=~/.hosts
# make less more friendly for non-text input files, see lesspipe(1) # make less more friendly for non-text input files, see lesspipe(1)
if [ -x /usr/bin/lesspipe ]; then eval "$(lesspipe)"; fi if [ -x /usr/bin/lesspipe ]; then eval "$(lesspipe)"; fi
@ -28,20 +31,6 @@ if [ -x /usr/bin/lesspipe ]; then eval "$(lesspipe)"; fi
# Homeshick # Homeshick
source ~/.homesick/repos/homeshick/homeshick.sh source ~/.homesick/repos/homeshick/homeshick.sh
# enable color support of ls and also add handy aliases
if hash dircolors 2>/dev/null; then
if [ -r ~/.dircolors ]; then
eval "$(dircolors -b ~/.dircolors)"
else
eval "$(dircolors -b)"
fi
alias ls='ls --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
source ~/.bash_env source ~/.bash_env
source ~/.bash_prompt source ~/.bash_prompt
source ~/.bash_aliases source ~/.bash_aliases

View file

@ -1,25 +1,16 @@
#!/bin/bash #!/bin/bash
GENERATED=${1:-~/.bash_completion.d/generated}
# Update hostlist # Update hostlist
. ~/workspace/snippets/bash/recursive-axfr.sh 0l.de > ~/.hosts.nulll python3 ~/workspace/snippets/python/recursive-axfr/recursive-axfr.py > ~/.hosts
. ~/workspace/snippets/bash/recursive-axfr.sh k8s.0l.de @kube-dns.kube-system.svc.k8s.0l.de. > ~/.hosts.k8s # python3 ~/workspace/snippets/python/recursive-axfr/recursive-axfr.py k8s.0l.de @kube-dns.kube-system.svc.k8s.0l.de. > ~/.hosts
echo '$include /etc/hosts.k8s' > ~/.hosts rm ${GENERATED}
echo '$include /etc/hosts.nulll' >> ~/.hosts
echo '$include /etc/hosts' >> ~/.hosts
# Update slow completions type kubectl > /dev/null 2>&1 && kubectl completion bash >> ${GENERATED}
COMPLETIONS_GENERATED="/Users/stv0g_local/.bash_completion.d/generated" type doctl > /dev/null 2>&1 && doctl completion bash >> ${GENERATED}
type helm > /dev/null 2>&1 && helm completion bash >> ${GENERATED}
type ykman > /dev/null 2>&1 && _YKMAN_COMPLETE=source ykman >> ${GENERATED}
rm ${COMPLETIONS_GENERATED} ykman oath accounts list > ~/.oath_tokens
if type kubectl > /dev/null 2>&1; then
kubectl completion bash >> ${COMPLETIONS_GENERATED}
fi
if type doctl > /dev/null 2>&1; then
doctl completion bash >> ${COMPLETIONS_GENERATED}
fi
if type helm > /dev/null 2>&1; then
helm completion bash >> ${COMPLETIONS_GENERATED}
fi