Compare commits
3 Commits
e868c2d11d
...
14686f57ef
Author | SHA1 | Date |
---|---|---|
|
14686f57ef | |
|
df41c1fc34 | |
|
f0a50e4d80 |
|
@ -1,5 +1,18 @@
|
||||||
#!/bin/zsh
|
#!/bin/zsh
|
||||||
|
|
||||||
|
when_binary_available() {
|
||||||
|
if has_binary "$@"; then
|
||||||
|
printf '1'
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
printf '0'
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
has_binary() {
|
||||||
|
command -v "$@" >/dev/null 2>&1
|
||||||
|
}
|
||||||
|
|
||||||
ZSH_DEBUG="${ZSH_DEBUG:-0}"
|
ZSH_DEBUG="${ZSH_DEBUG:-0}"
|
||||||
|
|
||||||
ZSH_ALIAS=${ZSH_ALIAS:-1}
|
ZSH_ALIAS=${ZSH_ALIAS:-1}
|
||||||
|
@ -7,6 +20,7 @@ ZSH_COMPAT_BASH_COMPLETION=${ZSH_COMPAT_BASH_COMPLETION:-1}
|
||||||
ZSH_CUSTOM=${ZSH_CUSTOM:-1}
|
ZSH_CUSTOM=${ZSH_CUSTOM:-1}
|
||||||
ZSH_DEFAULT_TERM=${ZSH_DEFAULT_TERM:-1}
|
ZSH_DEFAULT_TERM=${ZSH_DEFAULT_TERM:-1}
|
||||||
ZSH_GPG_PINENTRY_FIX=${ZSH_GPG_PINENTRY_FIX:-1}
|
ZSH_GPG_PINENTRY_FIX=${ZSH_GPG_PINENTRY_FIX:-1}
|
||||||
|
ZSH_PIPX=${ZSH_PIPX:-$(when_binary_available pipx)}
|
||||||
ZSH_POWERLINE="${ZSH_POWERLINE:-1}"
|
ZSH_POWERLINE="${ZSH_POWERLINE:-1}"
|
||||||
ZSH_PRINT_REBOOT_REQUIRED=${ZSH_PRINT_REBOOT_REQUIRED:-0} # hacky, see below
|
ZSH_PRINT_REBOOT_REQUIRED=${ZSH_PRINT_REBOOT_REQUIRED:-0} # hacky, see below
|
||||||
ZSH_SYNTAX_HIGHLIGHTING="${ZSH_SYNTAX_HIGHLIGHTING:-1}"
|
ZSH_SYNTAX_HIGHLIGHTING="${ZSH_SYNTAX_HIGHLIGHTING:-1}"
|
||||||
|
@ -48,9 +62,9 @@ log() {
|
||||||
|
|
||||||
# Compatibility mode for completions
|
# Compatibility mode for completions
|
||||||
section "compat: bash completion"
|
section "compat: bash completion"
|
||||||
if [ $ZSH_COMPAT_BASH_COMPLETION -gt 0 ]; then
|
if [ $ZSH_COMPAT_BASH_COMPLETION -gt 0 ] || [ $ZSH_PIPX -gt 0 ]; then
|
||||||
log "Enabling compatibility for bash completion scripts..."
|
log "Enabling compatibility for bash completion scripts..."
|
||||||
autoload bashcompinit
|
autoload -U bashcompinit
|
||||||
bashcompinit
|
bashcompinit
|
||||||
fi
|
fi
|
||||||
section_end
|
section_end
|
||||||
|
@ -80,6 +94,13 @@ if [ -d "$HOME/Library/Python/2.7" ]; then
|
||||||
export PATH
|
export PATH
|
||||||
fi
|
fi
|
||||||
section_end
|
section_end
|
||||||
|
section "pipx bin"
|
||||||
|
if [ $ZSH_PIPX -gt 0 ]; then
|
||||||
|
autoload -U bashcompinit
|
||||||
|
bashcompinit
|
||||||
|
eval "$(register-python-argcomplete pipx)"
|
||||||
|
fi
|
||||||
|
section_end
|
||||||
|
|
||||||
# Locale fix
|
# Locale fix
|
||||||
section "locale fix"
|
section "locale fix"
|
||||||
|
@ -100,7 +121,7 @@ if [ $ZSH_POWERLINE -gt 0 ]; then
|
||||||
log "$(powerline-daemon 2>&1)"
|
log "$(powerline-daemon 2>&1)"
|
||||||
|
|
||||||
log "Finding powerline..."
|
log "Finding powerline..."
|
||||||
POWERLINE_DIR="$(pip3 show powerline-status --isolated | grep '^Location:' | awk '{print $2}')"
|
POWERLINE_DIR="$(pipx runpip powerline-status show powerline-status --isolated | grep '^Location:' | awk '{print $2}')"
|
||||||
log "Powerline repository root: $POWERLINE_DIR"
|
log "Powerline repository root: $POWERLINE_DIR"
|
||||||
|
|
||||||
log "Preparing zstyle..."
|
log "Preparing zstyle..."
|
||||||
|
@ -150,7 +171,6 @@ if [ $ZSH_DEFAULT_TERM -gt 0 ] && [ -z "$TERM" ]; then
|
||||||
fi
|
fi
|
||||||
section_end
|
section_end
|
||||||
|
|
||||||
|
|
||||||
# gpg password via console
|
# gpg password via console
|
||||||
section "gpg pinentry fix"
|
section "gpg pinentry fix"
|
||||||
if [ $ZSH_GPG_PINENTRY_FIX -gt 0 ]; then
|
if [ $ZSH_GPG_PINENTRY_FIX -gt 0 ]; then
|
||||||
|
@ -166,7 +186,6 @@ if [ $ZSH_GPG_PINENTRY_FIX -gt 0 ]; then
|
||||||
fi
|
fi
|
||||||
section_end
|
section_end
|
||||||
|
|
||||||
|
|
||||||
# sugar to easily connect to remote docker hosts through SSH
|
# sugar to easily connect to remote docker hosts through SSH
|
||||||
section "ssh-based remote docker access"
|
section "ssh-based remote docker access"
|
||||||
ssh_docker() {
|
ssh_docker() {
|
||||||
|
@ -230,30 +249,6 @@ export ssh_docker_exit
|
||||||
export ssh_docker_cleanup
|
export ssh_docker_cleanup
|
||||||
section_end
|
section_end
|
||||||
|
|
||||||
# alias
|
|
||||||
section "alias"
|
|
||||||
if [ $ZSH_ALIAS -gt 0 ]; then
|
|
||||||
alias ssh-seidemannweb="ssh seiaufjt@cloud3-vm449.de-nserver.de"
|
|
||||||
alias ssh-pidashboard="ssh -p 10022 -L 5900:localhost:5900 ck@remote.seidemann.com"
|
|
||||||
alias docker-pidashboard="DOCKER_CERT_PATH=~/.docker/sw-pi-dashboard docker -H tcp://192.168.100.225:2375 --tlsverify"
|
|
||||||
alias docker-home="docker -H tcp://172.20.3.34:2375"
|
|
||||||
alias docker-winsrv2016-a="docker -H tcp://vm-winsrv2016-a:2375 --tlsverify"
|
|
||||||
alias wttr="curl -H 'Accept-Language: de' wttr.in/Reutlingen"
|
|
||||||
|
|
||||||
swproject() {
|
|
||||||
dir=$(find $HOME/src/gitlab.seidemann-web.com -type d -path "*/$1" -and -not -path '*/\.*' -print -quit)
|
|
||||||
if [ -z "$dir" ]; then
|
|
||||||
echo "Could not find project directory for $1." >&2
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
cd "$dir" || exit 1
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
export swproject
|
|
||||||
fi
|
|
||||||
section_end
|
|
||||||
|
|
||||||
|
|
||||||
# Reboot required? (hacky code)
|
# Reboot required? (hacky code)
|
||||||
section "reboot required?"
|
section "reboot required?"
|
||||||
if [ $ZSH_PRINT_REBOOT_REQUIRED -gt 0 ]; then
|
if [ $ZSH_PRINT_REBOOT_REQUIRED -gt 0 ]; then
|
||||||
|
@ -263,7 +258,6 @@ if [ $ZSH_PRINT_REBOOT_REQUIRED -gt 0 ]; then
|
||||||
fi
|
fi
|
||||||
section_end
|
section_end
|
||||||
|
|
||||||
|
|
||||||
# print env
|
# print env
|
||||||
section "Environment variables"
|
section "Environment variables"
|
||||||
log "$(export)"
|
log "$(export)"
|
||||||
|
|
|
@ -85,6 +85,7 @@ for pm in \
|
||||||
pacaur \
|
pacaur \
|
||||||
pacman \
|
pacman \
|
||||||
pip3 \
|
pip3 \
|
||||||
|
pipx \
|
||||||
npm \
|
npm \
|
||||||
yaourt \
|
yaourt \
|
||||||
yarn \
|
yarn \
|
||||||
|
|
|
@ -40,6 +40,13 @@ pip3_install() {
|
||||||
pip3 install --ignore-installed --user -U "$@"
|
pip3 install --ignore-installed --user -U "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pipx_install() {
|
||||||
|
for pkg in "$@"
|
||||||
|
do
|
||||||
|
pipx install --force "$pkg"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
download() {
|
download() {
|
||||||
curl -L "$@"
|
curl -L "$@"
|
||||||
}
|
}
|
||||||
|
@ -151,6 +158,12 @@ fi
|
||||||
|
|
||||||
if has_tags pm:pip3; then
|
if has_tags pm:pip3; then
|
||||||
pip3_install \
|
pip3_install \
|
||||||
|
pipx
|
||||||
|
add_tag pm:pipx
|
||||||
|
fi
|
||||||
|
|
||||||
|
if has_tags pm:pipx; then
|
||||||
|
pipx_install \
|
||||||
powerline-status \
|
powerline-status \
|
||||||
thefuck
|
thefuck
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue