From 9ccf45baf4500cc24b014121d60740eb1e5b2a90 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Wed, 17 Apr 2019 10:22:07 +0200 Subject: [PATCH 01/34] completion: avoid long running commands in shell startup --- home/.bash_completion | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/home/.bash_completion b/home/.bash_completion index d611f79..d5a573b 100644 --- a/home/.bash_completion +++ b/home/.bash_completion @@ -15,7 +15,27 @@ if type aws_completer > /dev/null 2>&1; then fi if type ykman > /dev/null 2>&1; then - source <(_YKMAN_COMPLETE=source ykman) + _ykman_completion() { + local IFS=$' +' + COMPREPLY=( $( env COMP_WORDS="${COMP_WORDS[*]}" \ + COMP_CWORD=$COMP_CWORD \ + _YKMAN_COMPLETE=complete $1 ) ) + return 0 + } + + _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 if type kubectl > /dev/null 2>&1; then @@ -28,4 +48,4 @@ fi if type doctl > /dev/null 2>&1; then source <(doctl completion bash) -fi \ No newline at end of file +fi From ae7671ae96e146ff2e7de71ef5a06dd9a22455a7 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Wed, 17 Apr 2019 10:23:46 +0200 Subject: [PATCH 02/34] ssh: add new hosts --- home/.ssh/config | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/home/.ssh/config b/home/.ssh/config index 79cafd3..fa304a3 100644 --- a/home/.ssh/config +++ b/home/.ssh/config @@ -58,7 +58,7 @@ Host acs-villas Host acs-buildbot User svg - HostName 134.130.169.43 + HostName 137.226.133.207 Host acs-vm User svg @@ -107,6 +107,16 @@ Host acs-os-k8s-master User ubuntu ForwardAgent yes +Host villas-test + HostName 142.93.233.220 + User root + ForwardAgent yes + +Host tud-villas + HostName 10.10.12.20 + User iepg + ForwardAgent yes + # # Private # From 174ed0e38b800b014e6053ed42f202c9b3ad3edd Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Wed, 17 Apr 2019 10:24:04 +0200 Subject: [PATCH 03/34] ssh: use root instead of acs-admin for acs-hyperX --- home/.ssh/config | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/home/.ssh/config b/home/.ssh/config index fa304a3..6f10b3a 100644 --- a/home/.ssh/config +++ b/home/.ssh/config @@ -65,15 +65,15 @@ Host acs-vm HostName 134.130.169.46 Host acs-hyper1 - User acs-admin + User root HostName 137.226.133.191 Host acs-hyper2 - User acs-admin + User root HostName 137.226.133.192 Host acs-hyper3 - User acs-admin + User root HostName 137.226.133.193 Host acs-os-reserve From 7dffd86d856c6e960be519e1272ecd034340acb4 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Wed, 17 Apr 2019 10:24:32 +0200 Subject: [PATCH 04/34] ssh: enable port forwarding for rcode --- home/.ssh/config | 1 + 1 file changed, 1 insertion(+) diff --git a/home/.ssh/config b/home/.ssh/config index 6f10b3a..b9000df 100644 --- a/home/.ssh/config +++ b/home/.ssh/config @@ -127,6 +127,7 @@ Host *.0l.dn42 Host *.0l.de ForwardAgent yes + RemoteForward 52698 127.0.0.1:52698 Host vog User pi From 65707a1c49d54052dfc8f1706a41ee4e70e317a8 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Wed, 17 Apr 2019 10:24:48 +0200 Subject: [PATCH 05/34] ssh: fix hostname of nag --- home/.ssh/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/home/.ssh/config b/home/.ssh/config index b9000df..fecc5af 100644 --- a/home/.ssh/config +++ b/home/.ssh/config @@ -140,7 +140,7 @@ Host lian ProxyJump nag HostName 172.23.156.2 -Host nag +Host nag.0l.de User stv0g ForwardAgent yes HostName nag.0l.de From 9e3d61fa7554afc3940656f9c2139bf4659daa71 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Wed, 17 Apr 2019 10:25:13 +0200 Subject: [PATCH 06/34] ssh: add acs-buildbot-2 --- home/.ssh/config | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/home/.ssh/config b/home/.ssh/config index fecc5af..8668639 100644 --- a/home/.ssh/config +++ b/home/.ssh/config @@ -60,6 +60,10 @@ Host acs-buildbot User svg HostName 137.226.133.207 +Host acs-buildbot-2 + User root + HostName 137.226.133.208 + Host acs-vm User svg HostName 134.130.169.46 From edf07933977a2056a43e649f580cb0c64c440ea1 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Wed, 17 Apr 2019 10:25:35 +0200 Subject: [PATCH 07/34] alias: add alias for vscodium --- home/.bash_aliases | 1 + 1 file changed, 1 insertion(+) diff --git a/home/.bash_aliases b/home/.bash_aliases index 3932fd0..3240c1b 100644 --- a/home/.bash_aliases +++ b/home/.bash_aliases @@ -26,6 +26,7 @@ alias psag='ps aux | grep' alias ka=killall alias k=kubectl +alias code=vscodium # Some shortcuts for me function moby() { From 959181745f1666f64ee7e70540b9c578bf59c03c Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Wed, 17 Apr 2019 10:25:55 +0200 Subject: [PATCH 08/34] alias: add alias for requesting invite token for ssb pub --- home/.bash_aliases | 2 ++ 1 file changed, 2 insertions(+) diff --git a/home/.bash_aliases b/home/.bash_aliases index 3240c1b..4bc5a4f 100644 --- a/home/.bash_aliases +++ b/home/.bash_aliases @@ -111,3 +111,5 @@ function restic() { } alias acs-pass='PASSWORD_STORE_DIR=~/workspace/rwth/acs/Passwords pass' + +alias chaos-family-invite='ssh -t root@chaos.family /root/sbot invite.create 1 | jq -r . | pbcopy' From 1a5af78fbfbae2a10229640f621ec43a356f198b Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Wed, 17 Apr 2019 10:26:17 +0200 Subject: [PATCH 09/34] env: fix merge conflict --- home/.bash_env | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/home/.bash_env b/home/.bash_env index 91f4d2a..d953924 100644 --- a/home/.bash_env +++ b/home/.bash_env @@ -1,4 +1,3 @@ -<<<<<<< HEAD export GOPATH=~/build/go source $HOME/.cargo/env @@ -9,23 +8,6 @@ fi if [ -d $GOPATH/bin ]; then export PATH=$GOPATH/bin:$PATH -======= -export PATH=~/bin/scripts:~/bin:/usr/local/bin:$PATH - -# We are on a Macports system -if [ -d /opt/local ]; then - export PATH=/opt/local/bin:$PATH - export PATH=/opt/local/Library/Frameworks/Python.framework/Versions/Current/bin/:$PATH - export PATH=/opt/local/libexec/gnubin:$PATH -fi - -if [ "$(id -u)" -eq "0" ]; then - if [ -d /opt/local/sbin ]; then - export PATH=/opt/local/sbin:$PATH - fi - - export PATH=/usr/local/sbin:$PATH ->>>>>>> f2eb8b201305d0dc745297c82466df103afbcc76 fi # OS X stuff if availabe From 89e885a80c286c83264a5cdcf7d122b48d702120 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Wed, 17 Apr 2019 10:26:40 +0200 Subject: [PATCH 10/34] env: fix location of Restic repo --- home/.bash_env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/home/.bash_env b/home/.bash_env index d953924..488b981 100644 --- a/home/.bash_env +++ b/home/.bash_env @@ -57,7 +57,7 @@ else export EDITOR=vim fi -export RESTIC_REPOSITORY="sftp://172.23.157.2//srv/dev-disk-by-label-data4/Backup/Restic/" +export RESTIC_REPOSITORY="sftp://172.23.157.2//srv/Data/Backup/Restic/Macbook" export GCC_COLORS="error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01" From c15a09ad9ba2c4f7eac56e70941e861ec918ce8d Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Sun, 21 Jul 2019 10:04:43 +0200 Subject: [PATCH 11/34] added acs-k8s to ssh config --- home/.ssh/config | 37 ++++++++++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/home/.ssh/config b/home/.ssh/config index 8668639..c80617c 100644 --- a/home/.ssh/config +++ b/home/.ssh/config @@ -44,6 +44,38 @@ Host *.os-cloud.eonerc.rwth-aachen.de Host lb-*.os-cloud.eonerc.rwth-aachen.de User ubuntu +# Kubernetes +Host acs-k8s-master + User ubuntu + HostName 137.226.248.165 + +Host acs-k8s-node* + ProxyJump acs-k8s-master + +Host acs-k8s-node1 + User ubuntu + HostName kubernetes-1 + +Host acs-k8s-node2 + User ubuntu + HostName kubernetes-2 + +Host acs-k8s-node3 + User ubuntu + HostName kubernetes-3 + +Host acs-k8s-node4 + User ubuntu + HostName kubernetes-4 + +Host acs-k8s-master-old + HostName 137.226.248.72 + User ubuntu + +Host acs-k8s-traefik + User ubuntu + HostName 137.226.248.149 + Host acs-reserver User svg HostName 137.226.133.195 @@ -106,11 +138,6 @@ Host os.fein-aachen.org ForwardAgent yes ProxyJump acs-villas -Host acs-os-k8s-master - HostName 137.226.248.72 - User ubuntu - ForwardAgent yes - Host villas-test HostName 142.93.233.220 User root From 43694bed09fcb8c4e01da6c9750a28acbf87ebfa Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Sun, 21 Jul 2019 10:05:22 +0200 Subject: [PATCH 12/34] remove obsolete ssh hosts --- home/.ssh/config | 8 -------- 1 file changed, 8 deletions(-) diff --git a/home/.ssh/config b/home/.ssh/config index c80617c..7e1c404 100644 --- a/home/.ssh/config +++ b/home/.ssh/config @@ -80,10 +80,6 @@ Host acs-reserver User svg HostName 137.226.133.195 -Host acs-os-openproject - User fedora - HostName 137.226.248.132 - Host acs-villas User svg HostName acs-villas.eonerc.rwth-aachen.de @@ -112,10 +108,6 @@ Host acs-hyper3 User root HostName 137.226.133.193 -Host acs-os-reserve - User fedora - HostName 137.226.248.103 - Host acs-os-villas User svg HostName 137.226.248.91 From d49a059b1eb7326625f071387457ba51a305c803 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Sun, 21 Jul 2019 10:06:14 +0200 Subject: [PATCH 13/34] add ERIGrid ssh hosts --- home/.ssh/config | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/home/.ssh/config b/home/.ssh/config index 7e1c404..f46e337 100644 --- a/home/.ssh/config +++ b/home/.ssh/config @@ -140,6 +140,18 @@ Host tud-villas User iepg ForwardAgent yes +Host dtu-villas + User thangu + ProxyJump villas-hub + ForwardAgent yes + HostName 10.10.12.22 + +Host tud-villas + User iepg + ProxyJump villas-hub + ForwardAgent yes + HostName 10.10.12.21 + # # Private # From 93c7ac6cbb438cd95baf66a061de8ff712d0b03d Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Sun, 21 Jul 2019 10:07:28 +0200 Subject: [PATCH 14/34] add tmux config --- home/.tmux.conf | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 home/.tmux.conf diff --git a/home/.tmux.conf b/home/.tmux.conf new file mode 100644 index 0000000..fefb4e8 --- /dev/null +++ b/home/.tmux.conf @@ -0,0 +1,28 @@ +set-option -g default-shell /bin/zsh +set-option -g default-terminal $TERM +set-option -g base-index 1 +setw -g pane-base-index 1 +setw -g window-status-format "#[fg=white]#[bg=blue] #I #[bg=blue]#[fg=white] #W " +setw -g window-status-current-format "#[bg=brightmagenta]#[fg=white] *#I #[fg=white,bold]#[bg=cyan] [#W] " +set -g pane-border-fg black +set -g pane-active-border-fg blue +set -g status-fg white +set -g status-bg blue +set -g status-left '' +set -g status-right '%a %m-%d %H:%M' +set -g mouse on +unbind C-b +set-option -g prefix C-a +bind-key C-a send-prefix +bind | split-window -h +bind \ split-window -h +bind - split-window -v +unbind '"' +unbind % +bind -n M-Left select-pane -L +bind -n M-Right select-pane -R +bind -n M-Up select-pane -U +bind -n M-Down select-pane -D +set -s escape-time 0 +bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "xclip -selection clipboard -i" +bind-key -T copy-mode MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "xclip -selection clipboard -i" From 988a8dc597b5146f57ef3548276c6616be910ffb Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Sun, 21 Jul 2019 10:07:58 +0200 Subject: [PATCH 15/34] use homebrew bash completions --- home/.bash_completion | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/home/.bash_completion b/home/.bash_completion index d5a573b..2ac80c5 100644 --- a/home/.bash_completion +++ b/home/.bash_completion @@ -6,14 +6,6 @@ if [ -d /usr/local/share/bash-completion/completions ]; then source /usr/local/share/bash-completion/completions/* fi -if [ -f /opt/local/etc/profile.d/bash_completion.sh ]; then - source /opt/local/etc/profile.d/bash_completion.sh -fi - -if type aws_completer > /dev/null 2>&1; then - complete -C aws_completer aws -fi - if type ykman > /dev/null 2>&1; then _ykman_completion() { local IFS=$' @@ -38,14 +30,14 @@ if type ykman > /dev/null 2>&1; then _ykman_completionetup; fi -if type kubectl > /dev/null 2>&1; then - source <(/opt/local/bin/kubectl completion bash) -fi - -if type helm > /dev/null 2>&1; then - source <(helm completion bash) -fi - -if type doctl > /dev/null 2>&1; then - source <(doctl completion bash) +HOMEBREW_PREFIX=$(brew --prefix) +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 From 4387b70a311955d3f2152355bdc97c5fb48d4ef4 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Sun, 21 Jul 2019 10:08:15 +0200 Subject: [PATCH 16/34] update bash aliases --- home/.bash_aliases | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/home/.bash_aliases b/home/.bash_aliases index 4bc5a4f..3145778 100644 --- a/home/.bash_aliases +++ b/home/.bash_aliases @@ -11,22 +11,15 @@ alias rm='rm -I' alias mv='mv -i' alias cp='cp -i' -alias dquilt='quilt --quiltrc=${HOME}/.quiltrc-dpkg' - -# git Aliases -alias g=git - -# I'd like to learn the vi keybinings -alias pico=vi -alias nano=vi -alias note=geeknote - alias psa='ps aux' alias psag='ps aux | grep' alias ka=killall +alias g=git alias k=kubectl -alias code=vscodium +alias a=ansible +alias c=code-insiders +alias e=$EDITOR # Some shortcuts for me function moby() { From 3fd8197d5951372c239dd51a6bb06ed021d37f0a Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Sun, 21 Jul 2019 10:11:00 +0200 Subject: [PATCH 17/34] remote ntfy support --- home/.bashrc | 8 -------- 1 file changed, 8 deletions(-) diff --git a/home/.bashrc b/home/.bashrc index 5e212b0..4b147db 100644 --- a/home/.bashrc +++ b/home/.bashrc @@ -23,14 +23,6 @@ HISTFILESIZE=99999999 # make less more friendly for non-text input files, see lesspipe(1) if [ -x /usr/bin/lesspipe ]; then eval "$(lesspipe)"; fi -# ntfy -export AUTO_NTFY_DONE_LONGER_THAN=-L10 -export AUTO_NTFY_DONE_UNFOCUSED_ONLY=-b -if [ -f /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/ntfy/shell_integration/bash-preexec.sh ]; then - source /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/ntfy/shell_integration/bash-preexec.sh - source /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/ntfy/shell_integration/auto-ntfy-done.sh -fi - # Homeshick source ~/.homesick/repos/homeshick/homeshick.sh source ~/.homesick/repos/homeshick/completions/homeshick-completion.bash From cd7ca66202437fe607b10f03550777dd3a12cb74 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Sun, 21 Jul 2019 10:11:21 +0200 Subject: [PATCH 18/34] remove duplicated homeshick include --- home/.bashrc | 3 --- 1 file changed, 3 deletions(-) diff --git a/home/.bashrc b/home/.bashrc index 4b147db..8de590b 100644 --- a/home/.bashrc +++ b/home/.bashrc @@ -45,6 +45,3 @@ if hash dircolors 2>/dev/null; then alias fgrep='fgrep --color=auto' alias egrep='egrep --color=auto' fi - -source ~/.homesick/repos/homeshick/homeshick.sh -source ~/.homesick/repos/homeshick/completions/homeshick-completion.bash From e850ec8d09e889327e95ace2546912fe96a7e513 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Sun, 21 Jul 2019 10:12:04 +0200 Subject: [PATCH 19/34] update EDITOR variable --- home/.bash_env | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/home/.bash_env b/home/.bash_env index 488b981..63c1dd5 100644 --- a/home/.bash_env +++ b/home/.bash_env @@ -51,8 +51,8 @@ if [ -r ~/.gpg-agent-info ]; then export SSH_AGENT_PID fi -if [ -x /usr/local/bin/code ]; then - export EDITOR="/usr/local/bin/code -w" +if [ -x /usr/local/bin/code-insiders ]; then + export EDITOR="/usr/local/bin/code-insiders -w" else export EDITOR=vim fi @@ -61,7 +61,6 @@ export RESTIC_REPOSITORY="sftp://172.23.157.2//srv/Data/Backup/Restic/Macbook" export GCC_COLORS="error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01" -export EDITOR=vim export DEBEMAIL="post@steffenvogel.de" export DEBFULLNAME="Steffen Vogel" From 80f3d00a3add1e24aed67920e93fd4fad6e8036f Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Sun, 21 Jul 2019 10:13:13 +0200 Subject: [PATCH 20/34] update iTerm2 config --- iterm2/com.googlecode.iterm2.plist | 60 +++++++++++++++++++----------- 1 file changed, 38 insertions(+), 22 deletions(-) diff --git a/iterm2/com.googlecode.iterm2.plist b/iterm2/com.googlecode.iterm2.plist index e9158a0..220953c 100644 --- a/iterm2/com.googlecode.iterm2.plist +++ b/iterm2/com.googlecode.iterm2.plist @@ -388,10 +388,16 @@ 2 LoadPrefsFromCustomFolder + NSFontPanelAttributes + 1, 0 NSNavLastRootDirectory - ~/.homesick/repos/base16-iterm2 + ~/Documents + NSNavLastUserSetHideExtensionButtonState + NSNavPanelExpandedSizeForOpenMode {1114, 448} + NSNavPanelExpandedSizeForSaveMode + {712, 448} NSQuotedKeystrokeBinding NSRepeatCountBinding @@ -407,24 +413,24 @@ NSTableView Columns v2 KeyBingingTable - YnBsaXN0MDDUAQIDBAUGNjdYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS - AAGGoK4HCA8aGxwdHh8gJjAxMlUkbnVsbNIJCgsOWk5TLm9iamVjdHNWJGNsYXNzogwN - gAKACoAN0xAJChEVGVdOUy5rZXlzoxITFIADgASABaMWFxiABoAHgAiACVpJZGVudGlm - aWVyVVdpZHRoVkhpZGRlblEwI0BowAAAAAAACNIhIiMkWiRjbGFzc25hbWVYJGNsYXNz - ZXNcTlNEaWN0aW9uYXJ5oiMlWE5TT2JqZWN00xAJCicrGaMSExSAA4AEgAWjLC0YgAuA - DIAIgAlRMSNAdKGdsi0OVtIhIjM0Xk5TTXV0YWJsZUFycmF5ozM1JVdOU0FycmF5XxAP - TlNLZXllZEFyY2hpdmVy0Tg5VUFycmF5gAEACAARABoAIwAtADIANwBGAEwAUQBcAGMA - ZgBoAGoAbABzAHsAfwCBAIMAhQCJAIsAjQCPAJEAnACiAKkAqwC0ALUAugDFAM4A2wDe - AOcA7gDyAPQA9gD4APwA/gEAAQIBBAEGAQ8BFAEjAScBLwFBAUQBSgAAAAAAAAIBAAAA + YnBsaXN0MDDUAQIDBAUGBwpYJHZlcnNpb25ZJGFyY2hpdmVyVCR0b3BYJG9iamVjdHMS + AAGGoF8QD05TS2V5ZWRBcmNoaXZlctEICVVBcnJheYABrgsMEx4fICEiIyQqNDU2VSRu + dWxs0g0ODxJaTlMub2JqZWN0c1YkY2xhc3OiEBGAAoAKgA3TFA0OFRkdV05TLmtleXOj + FhcYgAOABIAFoxobHIAGgAeACIAJWklkZW50aWZpZXJVV2lkdGhWSGlkZGVuUTAjQGjA + AAAAAAAI0iUmJyhaJGNsYXNzbmFtZVgkY2xhc3Nlc1xOU0RpY3Rpb25hcnmiJylYTlNP + YmplY3TTFA0OKy8doxYXGIADgASABaMwMRyAC4AMgAiACVExI0B0oZ2yLQ5W0iUmNzhe + TlNNdXRhYmxlQXJyYXmjNzkpV05TQXJyYXkACAARABoAJAApADIANwBJAEwAUgBUAGMA + aQBuAHkAgACDAIUAhwCJAJAAmACcAJ4AoACiAKYAqACqAKwArgC5AL8AxgDIANEA0gDX + AOIA6wD4APsBBAELAQ8BEQETARUBGQEbAR0BHwEhASMBLAExAUABRAAAAAAAAAIBAAAA AAAAADoAAAAAAAAAAAAAAAAAAAFM NSTableView Sort Ordering v2 KeyBingingTable - YnBsaXN0MDDUAQIDBAUGFBVYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS - AAGGoKMHCA1VJG51bGzSCQoLDFpOUy5vYmplY3RzViRjbGFzc6CAAtIODxARWiRjbGFz - c25hbWVYJGNsYXNzZXNeTlNNdXRhYmxlQXJyYXmjEBITV05TQXJyYXlYTlNPYmplY3Rf - EA9OU0tleWVkQXJjaGl2ZXLRFhdVQXJyYXmAAQgRGiMtMjc7QUZRWFlbYGt0g4ePmKqt - swAAAAAAAAEBAAAAAAAAABgAAAAAAAAAAAAAAAAAAAC1 + YnBsaXN0MDDUAQIDBAUGBwpYJHZlcnNpb25ZJGFyY2hpdmVyVCR0b3BYJG9iamVjdHMS + AAGGoF8QD05TS2V5ZWRBcmNoaXZlctEICVVBcnJheYABowsMEVUkbnVsbNINDg8QWk5T + Lm9iamVjdHNWJGNsYXNzoIAC0hITFBVaJGNsYXNzbmFtZVgkY2xhc3Nlc15OU011dGFi + bGVBcnJheaMUFhdXTlNBcnJheVhOU09iamVjdAgRGiQpMjdJTFJUWF5jbnV2eH2IkaCk + rAAAAAAAAAEBAAAAAAAAABgAAAAAAAAAAAAAAAAAAAC1 NSTableView Supports v2 KeyBingingTable @@ -433,22 +439,24 @@ TB Is Shown 1 + NSWindow Frame NSFontPanel + 606 120 830 459 0 0 1440 877 NSWindow Frame ProfilesPanel - 54 219 735 382 0 0 1440 878 + 673 327 735 382 0 0 1440 877 NSWindow Frame SUUpdateAlert 410 363 620 392 0 0 1440 877 NSWindow Frame SessionsPreferences - 302 231 599 521 0 0 1440 877 + 311 228 606 469 0 0 1440 877 NSWindow Frame SharedPreferences - 158 246 796 486 0 0 1440 877 + 158 166 796 486 0 0 1440 877 NSWindow Frame UKCrashReporter 99 294 592 584 0 0 1440 878 NSWindow Frame iTerm Window 0 - 1 0 1440 877 0 0 1440 877 + 0 119 948 758 0 0 1440 877 NSWindow Frame iTerm Window 1 721 425 570 452 0 0 1440 877 NSWindow Frame iTerm Window 2 - 0 0 1440 878 0 0 1440 878 + 0 425 570 452 0 0 1440 877 NeverWarnAboutPossibleOverrides NeverWarnAboutPossibleOverrides_selection @@ -1172,8 +1180,14 @@ 0 NoSyncPermissionToShowTip + NoSyncSaveDocumentAsPathSet_saveDocumentAs: + + NoSyncSuppressClipboardAccessDeniedWarning + NoSyncTimeOfFirstLaunchOfVersionWithTip 518372566.76529002 + NoSyncTurnOffMouseReportingOnHostChange + PMPrintingExpandedStateForPrint2 PasteTabToStringTabStopSize @@ -1224,9 +1238,11 @@ SUHasLaunchedBefore SULastCheckTime - 2018-10-30T21:43:15Z + 2019-07-20T16:34:18Z SUSendProfileInfo + ShowFullScreenTabBar + SplitPaneDimmingAmount 0.40545873397435894 SuppressRestartAnnouncement @@ -1260,7 +1276,7 @@ findRegex_iTerm iTerm Version - 3.2.4 + 3.2.9 metalMaximizeThroughput From 72d28f638a2ded57b3b68b83a07d9511bc79248c Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Sun, 21 Jul 2019 10:25:39 +0200 Subject: [PATCH 21/34] use vscode as diff/merge tool for stree --- home/.gitconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/home/.gitconfig b/home/.gitconfig index cd2c9c2..7eea7a7 100644 --- a/home/.gitconfig +++ b/home/.gitconfig @@ -40,10 +40,10 @@ autocorrect = 1 [difftool "sourcetree"] - cmd = /opt/local/bin/meld $LOCAL $REMOTE + cmd = code-insiders --diff --wait \"$LOCAL\" \"$REMOTE\" path = [mergetool "sourcetree"] - cmd = /opt/local/bin/meld $LOCAL $REMOTE + cmd = code-insiders -n --wait \"$MERGED\" trustExitCode = true [diff "xml"] From 786f161ac6ec991ee95dc26e2ed28d4ebdf3fbf5 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Sun, 21 Jul 2019 10:27:57 +0200 Subject: [PATCH 22/34] update package script --- debian.sh => packages.sh | 43 ++++++++++++++++++++++++++++++++-------- 1 file changed, 35 insertions(+), 8 deletions(-) rename debian.sh => packages.sh (52%) diff --git a/debian.sh b/packages.sh similarity index 52% rename from debian.sh rename to packages.sh index 699a4ec..1d4d287 100755 --- a/debian.sh +++ b/packages.sh @@ -8,7 +8,6 @@ apt-get purge \ nano apt-get install \ - ansible autocutsel \ bind9-utils \ build-essential \ @@ -21,20 +20,15 @@ apt-get install \ fonts-font-awesome \ gimp \ git \ - git-gui \ - gitk \ gnuplot htop \ - i3 \ inkscape \ libreoffice \ lynx \ meld \ - nitrogen nitrogen \ pavucontrol \ pidgin \ - rxvt-unicode \ screen \ sshfs \ sudo \ @@ -43,6 +37,39 @@ apt-get install \ texlive-luatex \ texlive-pdflatex vim \ - vlc \ - xsel \ + vlc +wget -O /etc/yum.repos.d/sumieri-sway.repo https://copr.fedorainfracloud.org/coprs/gumieri/sway/repo/fedora-30/gumieri-sway-fedora-30.repo + +dnf install \ + sway + + +pip3 install \ + ansible + + +brew install \ + automake \ + bash-completion@2 \ + boringtun \ + amar1729/formulae/browserpass \ + coreutils \ + curl \ + doctl \ + gcc \ + git \ + graphviz \ + htop \ + kubernetes-cli \ + pass \ + protobuf \ + pwgen \ + radare2 \ + restic \ + ripgrep \ + wget \ + wireshark \ + +brew cask install \ + meld From 947130f0c641ad404fc8eedc72527606562a10b1 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Sun, 21 Jul 2019 10:28:27 +0200 Subject: [PATCH 23/34] update restic password --- home/.bash_aliases | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/home/.bash_aliases b/home/.bash_aliases index 3145778..3c26525 100644 --- a/home/.bash_aliases +++ b/home/.bash_aliases @@ -99,7 +99,7 @@ function restic() { local RESTIC=$(which restic) # Start original restic executable with short-lived keys - RESTIC_PASSWORD="$(pass restic/b2)" \ + RESTIC_PASSWORD="$(pass restic/macbook)" \ $RESTIC $@ } From fdcb15882476c81f9ecdf231153a2e4b98d4e111 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Sun, 21 Jul 2019 10:28:46 +0200 Subject: [PATCH 24/34] update buildbot ssh hosts --- home/.ssh/config | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/home/.ssh/config b/home/.ssh/config index f46e337..580ca85 100644 --- a/home/.ssh/config +++ b/home/.ssh/config @@ -84,17 +84,13 @@ Host acs-villas User svg HostName acs-villas.eonerc.rwth-aachen.de -Host acs-buildbot - User svg +Host acs-mac-buildbot + User acs-admin HostName 137.226.133.207 -Host acs-buildbot-2 - User root - HostName 137.226.133.208 - -Host acs-vm +Host acs-buildbot User svg - HostName 134.130.169.46 + HostName 137.226.133.208 Host acs-hyper1 User root From e98fd9c6232e8f31dd1a9a9b44d785de24e365f0 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Sun, 21 Jul 2019 10:29:00 +0200 Subject: [PATCH 25/34] add villas-hub ssh host --- home/.ssh/config | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/home/.ssh/config b/home/.ssh/config index 580ca85..8dd67e1 100644 --- a/home/.ssh/config +++ b/home/.ssh/config @@ -148,6 +148,12 @@ Host tud-villas ForwardAgent yes HostName 10.10.12.21 + +Host villas-hub + User root + HostName hub.villas.fein-aachen.org + ForwardAgent yes + # # Private # From 768aa1f1b47c4ba1b6c08b92a9fc944d574e54f2 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Sun, 21 Jul 2019 10:29:16 +0200 Subject: [PATCH 26/34] update bash env for Homebrew --- home/.bash_env | 35 ++++++++++++----------------------- 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/home/.bash_env b/home/.bash_env index 63c1dd5..f1f9c6b 100644 --- a/home/.bash_env +++ b/home/.bash_env @@ -1,46 +1,35 @@ export GOPATH=~/build/go -source $HOME/.cargo/env +source ${HOME}/.cargo/env if [ -d ~/bin ]; then - export PATH=$PATH:~/bin/scripts:~/bin + export PATH=${PATH}:~/bin/scripts:~/bin fi -if [ -d $GOPATH/bin ]; then - export PATH=$GOPATH/bin:$PATH +if [ -d ~/.npm-global/bin ]; then + export PATH=${PATH}:~/.npm-global/bin/ +fi + +if [ -d ${GOPATH}/bin ]; then + export PATH=${GOPATH}/bin:${PATH} fi # OS X stuff if availabe -if [[ "$OSTYPE" == "darwin"* ]]; then - if [ -d /opt/local/bin ]; then - export PATH=/opt/local/bin:/opt/local/sbin:$PATH - fi - - if [ -d /opt/local/libexec/gnubin ]; then - export PATH=/opt/local/libexec/gnubin:$PATH - fi - +if [[ "${OSTYPE}" == "darwin"* ]]; then # MacGPG2 if [ -d /usr/local/MacGPG2/bin/ ]; then - export PATH=/usr/local/MacGPG2/bin/:$PATH + export PATH=/usr/local/MacGPG2/bin/:${PATH} fi # Macports man-pages if [ -d /opt/local/share/man ]; then - export MANPATH=/opt/local/share/man:$MANPATH + export MANPATH=/opt/local/share/man:${MANPATH} fi # Linux man-pages if [ -d /opt/man-pages ]; then - export MANPATH=/opt/man-pages:$MANPATH + export MANPATH=/opt/man-pages:${MANPATH} fi - - # Python - for VER in 3.7 2.7; do - if [ -d /opt/local/Library/Frameworks/Python.framework/Versions/$VER/bin ]; then - export PATH=/opt/local/Library/Frameworks/Python.framework/Versions/$VER/bin:$PATH - fi - done fi if [ -r ~/.gpg-agent-info ]; then From 6bd774fd16e63b77cb23da1d5c82c18d6c9f63b3 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Sun, 21 Jul 2019 10:29:34 +0200 Subject: [PATCH 27/34] add rck ssh host --- home/.ssh/config | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/home/.ssh/config b/home/.ssh/config index 8dd67e1..0733bb7 100644 --- a/home/.ssh/config +++ b/home/.ssh/config @@ -172,6 +172,11 @@ Host vog ForwardAgent yes HostName 172.23.156.9 +Host rck + User rock64 + ForwardAgent yes + HostName 172.23.157.3 + Host lian User stv0g ProxyJump nag From dfe346b6b153468b84e7229f79a4b831c5b6e2ca Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Sun, 21 Jul 2019 10:29:44 +0200 Subject: [PATCH 28/34] add nrg5 ssh host --- home/.ssh/config | 3 +++ 1 file changed, 3 insertions(+) diff --git a/home/.ssh/config b/home/.ssh/config index 0733bb7..f5651da 100644 --- a/home/.ssh/config +++ b/home/.ssh/config @@ -148,6 +148,9 @@ Host tud-villas ForwardAgent yes HostName 10.10.12.21 +Host acs-nrg5-vpmu-demo + HostName 10.100.1.142 + User ubuntu Host villas-hub User root From a416a7b74726572337f594451f45bd9b45f8ce22 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Sun, 21 Jul 2019 10:30:02 +0200 Subject: [PATCH 29/34] add acs-fedora-svg-2 ssh host --- home/.ssh/config | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/home/.ssh/config b/home/.ssh/config index f5651da..fe04af0 100644 --- a/home/.ssh/config +++ b/home/.ssh/config @@ -112,6 +112,10 @@ Host acs-os-fein-website User fedora HostName 137.226.248.111 +Host acs-fedora-svg-2 + User svg + HostName 134.130.169.13 + Host inl-villas User root HostName 141.221.118.93 From 1d1c9b6490e2c6e125bbb156ade26ab248d24a19 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Sun, 21 Jul 2019 10:30:29 +0200 Subject: [PATCH 30/34] do not use ssh proxyjump by default --- home/.ssh/config | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/home/.ssh/config b/home/.ssh/config index fe04af0..1e9b732 100644 --- a/home/.ssh/config +++ b/home/.ssh/config @@ -39,8 +39,9 @@ Host acs-* Host *.os-cloud.eonerc.rwth-aachen.de ForwardAgent yes - ProxyJump acs-stargate +# ProxyJump acs-stargate +# Load Balancer Host lb-*.os-cloud.eonerc.rwth-aachen.de User ubuntu @@ -167,7 +168,6 @@ Host villas-hub Host *.0l.dn42 ForwardAgent yes - ProxyJump nag Host *.0l.de ForwardAgent yes @@ -175,7 +175,6 @@ Host *.0l.de Host vog User pi - ProxyJump nag ForwardAgent yes HostName 172.23.156.9 @@ -186,7 +185,6 @@ Host rck Host lian User stv0g - ProxyJump nag HostName 172.23.156.2 Host nag.0l.de From 5c6034ce9db26c490e2a2f6a721193ee54c7492f Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Sun, 21 Jul 2019 10:32:23 +0200 Subject: [PATCH 31/34] update README --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 7279405..487a1b7 100644 --- a/README.md +++ b/README.md @@ -9,10 +9,9 @@ I'm using [homeshick](https://github.com/andsens/homeshick) to manage them. Have a look at the [bootstrapping script](bootstrap.sh) to get started! ```bash -wget -O- https://git.io/vadaZ | bash +wget -O- https://git.0l.de/stv0g/dotfiles/raw/branch/master/bootstrap.sh | bash ``` - #### Author Steffen Vogel From c0767570d28407081c6be043867fed39a16ed312 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Sun, 21 Jul 2019 10:39:27 +0200 Subject: [PATCH 32/34] activate brew completions only if brew is available --- home/.bash_completion | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/home/.bash_completion b/home/.bash_completion index 2ac80c5..b8ea7e8 100644 --- a/home/.bash_completion +++ b/home/.bash_completion @@ -30,14 +30,14 @@ if type ykman > /dev/null 2>&1; then _ykman_completionetup; fi -HOMEBREW_PREFIX=$(brew --prefix) -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 +if command -v brew; then + HOMEBREW_PREFIX=$(brew --prefix) + 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 From ca73133eeb568ddd0de640e422e240178fd2b2ad Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Sun, 21 Jul 2019 10:39:42 +0200 Subject: [PATCH 33/34] update git url in bootstrap.sh --- bootstrap.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap.sh b/bootstrap.sh index d5fc63d..91256c4 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -25,7 +25,7 @@ gc https://github.com/chriskempson/base16-xresources base16-xresources gc https://github.com/chriskempson/base16-vim base16-vim gc https://github.com/chriskempson/base16-iterm2 base16-iterm2 gc https://github.com/longld/peda peda -gc https://github.com/stv0g/dotfiles dotfiles +gc https://git.0l.de/stv0g/dotfiles.git dotfiles if [[ "$OSTYPE" == "darwin"* ]]; then sudo gc http://git.kernel.org/pub/scm/docs/man-pages/man-pages /opt/man-pages From d51092a85f8bbc49d6907467f7c5f628931f5eac Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Sun, 21 Jul 2019 15:01:24 +0200 Subject: [PATCH 34/34] add better completions for homebrew --- completion/docker-compose.sh | 430 ---------- completion/docker.sh | 1562 ---------------------------------- home/.bash_aliases | 8 + home/.bash_completion | 12 +- home/.bash_env | 9 +- home/.bashrc | 2 +- packages.sh | 23 + 7 files changed, 49 insertions(+), 1997 deletions(-) delete mode 100644 completion/docker-compose.sh delete mode 100644 completion/docker.sh diff --git a/completion/docker-compose.sh b/completion/docker-compose.sh deleted file mode 100644 index fe46a33..0000000 --- a/completion/docker-compose.sh +++ /dev/null @@ -1,430 +0,0 @@ -#!bash -# -# bash completion for docker-compose -# -# This work is based on the completion for the docker command. -# -# This script provides completion of: -# - commands and their options -# - service names -# - filepaths -# -# To enable the completions either: -# - place this file in /etc/bash_completion.d -# or -# - copy this file to e.g. ~/.docker-compose-completion.sh and add the line -# below to your .bashrc after bash completion features are loaded -# . ~/.docker-compose-completion.sh - - -# For compatibility reasons, Compose and therefore its completion supports several -# stack compositon files as listed here, in descending priority. -# Support for these filenames might be dropped in some future version. -__docker_compose_compose_file() { - local file - for file in docker-compose.y{,a}ml fig.y{,a}ml ; do - [ -e $file ] && { - echo $file - return - } - done - echo docker-compose.yml -} - -# Extracts all service names from the compose file. -___docker_compose_all_services_in_compose_file() { - awk -F: '/^[a-zA-Z0-9]/{print $1}' "${compose_file:-$(__docker_compose_compose_file)}" 2>/dev/null -} - -# All services, even those without an existing container -__docker_compose_services_all() { - COMPREPLY=( $(compgen -W "$(___docker_compose_all_services_in_compose_file)" -- "$cur") ) -} - -# All services that have an entry with the given key in their compose_file section -___docker_compose_services_with_key() { - # flatten sections to one line, then filter lines containing the key and return section name. - awk '/^[a-zA-Z0-9]/{printf "\n"};{printf $0;next;}' "${compose_file:-$(__docker_compose_compose_file)}" | awk -F: -v key=": +$1:" '$0 ~ key {print $1}' -} - -# All services that are defined by a Dockerfile reference -__docker_compose_services_from_build() { - COMPREPLY=( $(compgen -W "$(___docker_compose_services_with_key build)" -- "$cur") ) -} - -# All services that are defined by an image -__docker_compose_services_from_image() { - COMPREPLY=( $(compgen -W "$(___docker_compose_services_with_key image)" -- "$cur") ) -} - -# The services for which containers have been created, optionally filtered -# by a boolean expression passed in as argument. -__docker_compose_services_with() { - local containers names - containers="$(docker-compose 2>/dev/null ${compose_file:+-f $compose_file} ${compose_project:+-p $compose_project} ps -q)" - names=( $(docker 2>/dev/null inspect --format "{{if ${1:-true}}} {{ .Name }} {{end}}" $containers) ) - names=( ${names[@]%_*} ) # strip trailing numbers - names=( ${names[@]#*_} ) # strip project name - COMPREPLY=( $(compgen -W "${names[*]}" -- "$cur") ) -} - -# The services for which at least one paused container exists -__docker_compose_services_paused() { - __docker_compose_services_with '.State.Paused' -} - -# The services for which at least one running container exists -__docker_compose_services_running() { - __docker_compose_services_with '.State.Running' -} - -# The services for which at least one stopped container exists -__docker_compose_services_stopped() { - __docker_compose_services_with 'not .State.Running' -} - - -_docker_compose_build() { - case "$cur" in - -*) - COMPREPLY=( $( compgen -W "--help --no-cache" -- "$cur" ) ) - ;; - *) - __docker_compose_services_from_build - ;; - esac -} - - -_docker_compose_docker_compose() { - case "$prev" in - --file|-f) - _filedir "y?(a)ml" - return - ;; - --project-name|-p) - return - ;; - esac - - case "$cur" in - -*) - COMPREPLY=( $( compgen -W "--help -h --verbose --version -v --file -f --project-name -p" -- "$cur" ) ) - ;; - *) - COMPREPLY=( $( compgen -W "${commands[*]}" -- "$cur" ) ) - ;; - esac -} - - -_docker_compose_help() { - COMPREPLY=( $( compgen -W "${commands[*]}" -- "$cur" ) ) -} - - -_docker_compose_kill() { - case "$prev" in - -s) - COMPREPLY=( $( compgen -W "SIGHUP SIGINT SIGKILL SIGUSR1 SIGUSR2" -- "$(echo $cur | tr '[:lower:]' '[:upper:]')" ) ) - return - ;; - esac - - case "$cur" in - -*) - COMPREPLY=( $( compgen -W "--help -s" -- "$cur" ) ) - ;; - *) - __docker_compose_services_running - ;; - esac -} - - -_docker_compose_logs() { - case "$cur" in - -*) - COMPREPLY=( $( compgen -W "--help --no-color" -- "$cur" ) ) - ;; - *) - __docker_compose_services_all - ;; - esac -} - - -_docker_compose_migrate_to_labels() { - case "$cur" in - -*) - COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) - ;; - esac -} - - -_docker_compose_pause() { - case "$cur" in - -*) - COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) - ;; - *) - __docker_compose_services_running - ;; - esac -} - - -_docker_compose_port() { - case "$prev" in - --protocol) - COMPREPLY=( $( compgen -W "tcp udp" -- "$cur" ) ) - return; - ;; - --index) - return; - ;; - esac - - case "$cur" in - -*) - COMPREPLY=( $( compgen -W "--help --index --protocol" -- "$cur" ) ) - ;; - *) - __docker_compose_services_all - ;; - esac -} - - -_docker_compose_ps() { - case "$cur" in - -*) - COMPREPLY=( $( compgen -W "--help -q" -- "$cur" ) ) - ;; - *) - __docker_compose_services_all - ;; - esac -} - - -_docker_compose_pull() { - case "$cur" in - -*) - COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) - ;; - *) - __docker_compose_services_from_image - ;; - esac -} - - -_docker_compose_restart() { - case "$prev" in - --timeout|-t) - return - ;; - esac - - case "$cur" in - -*) - COMPREPLY=( $( compgen -W "--help --timeout -t" -- "$cur" ) ) - ;; - *) - __docker_compose_services_running - ;; - esac -} - - -_docker_compose_rm() { - case "$cur" in - -*) - COMPREPLY=( $( compgen -W "--force -f --help -v" -- "$cur" ) ) - ;; - *) - __docker_compose_services_stopped - ;; - esac -} - - -_docker_compose_run() { - case "$prev" in - -e) - COMPREPLY=( $( compgen -e -- "$cur" ) ) - compopt -o nospace - return - ;; - --entrypoint|--user|-u) - return - ;; - esac - - case "$cur" in - -*) - COMPREPLY=( $( compgen -W "-d --entrypoint -e --help --no-deps --rm --service-ports --publish -p -T --user -u" -- "$cur" ) ) - ;; - *) - __docker_compose_services_all - ;; - esac -} - - -_docker_compose_scale() { - case "$prev" in - =) - COMPREPLY=("$cur") - return - ;; - --timeout|-t) - return - ;; - esac - - case "$cur" in - -*) - COMPREPLY=( $( compgen -W "--help --timeout -t" -- "$cur" ) ) - ;; - *) - COMPREPLY=( $(compgen -S "=" -W "$(___docker_compose_all_services_in_compose_file)" -- "$cur") ) - compopt -o nospace - ;; - esac -} - - -_docker_compose_start() { - case "$cur" in - -*) - COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) - ;; - *) - __docker_compose_services_stopped - ;; - esac -} - - -_docker_compose_stop() { - case "$prev" in - --timeout|-t) - return - ;; - esac - - case "$cur" in - -*) - COMPREPLY=( $( compgen -W "--help --timeout -t" -- "$cur" ) ) - ;; - *) - __docker_compose_services_running - ;; - esac -} - - -_docker_compose_unpause() { - case "$cur" in - -*) - COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) - ;; - *) - __docker_compose_services_paused - ;; - esac -} - - -_docker_compose_up() { - case "$prev" in - --timeout|-t) - return - ;; - esac - - case "$cur" in - -*) - COMPREPLY=( $( compgen -W "-d --help --no-build --no-color --no-deps --no-recreate --force-recreate --timeout -t" -- "$cur" ) ) - ;; - *) - __docker_compose_services_all - ;; - esac -} - - -_docker_compose_version() { - case "$cur" in - -*) - COMPREPLY=( $( compgen -W "--short" -- "$cur" ) ) - ;; - esac -} - - -_docker_compose() { - local previous_extglob_setting=$(shopt -p extglob) - shopt -s extglob - - local commands=( - build - help - kill - logs - migrate-to-labels - pause - port - ps - pull - restart - rm - run - scale - start - stop - unpause - up - version - ) - - COMPREPLY=() - local cur prev words cword - _get_comp_words_by_ref -n : cur prev words cword - - # search subcommand and invoke its handler. - # special treatment of some top-level options - local command='docker_compose' - local counter=1 - local compose_file compose_project - while [ $counter -lt $cword ]; do - case "${words[$counter]}" in - --file|-f) - (( counter++ )) - compose_file="${words[$counter]}" - ;; - --project-name|p) - (( counter++ )) - compose_project="${words[$counter]}" - ;; - -*) - ;; - *) - command="${words[$counter]}" - break - ;; - esac - (( counter++ )) - done - - local completions_func=_docker_compose_${command//-/_} - declare -F $completions_func >/dev/null && $completions_func - - eval "$previous_extglob_setting" - return 0 -} - -complete -F _docker_compose docker-compose diff --git a/completion/docker.sh b/completion/docker.sh deleted file mode 100644 index 63d3fc5..0000000 --- a/completion/docker.sh +++ /dev/null @@ -1,1562 +0,0 @@ -#!/bin/bash -# -# bash completion file for core docker commands -# -# This script provides completion of: -# - commands and their options -# - container ids and names -# - image repos and tags -# - filepaths -# -# To enable the completions either: -# - place this file in /etc/bash_completion.d -# or -# - copy this file to e.g. ~/.docker-completion.sh and add the line -# below to your .bashrc after bash completion features are loaded -# . ~/.docker-completion.sh -# -# Configuration: -# -# You can tailor completion for the "events", "history", "inspect", "run", -# "rmi" and "save" commands by settings the following environment -# variables: -# -# DOCKER_COMPLETION_SHOW_IMAGE_IDS -# "none" - Show names only (default) -# "non-intermediate" - Show names and ids, but omit intermediate image IDs -# "all" - Show names and ids, including intermediate image IDs -# -# DOCKER_COMPLETION_SHOW_TAGS -# "yes" - include tags in completion options (default) -# "no" - don't include tags in completion options - -# -# Note: -# Currently, the completions will not work if the docker daemon is not -# bound to the default communication port/socket -# If the docker daemon is using a unix socket for communication your user -# must have access to the socket for the completions to function correctly -# -# Note for developers: -# Please arrange options sorted alphabetically by long name with the short -# options immediately following their corresponding long form. -# This order should be applied to lists, alternatives and code blocks. - -__docker_q() { - docker ${host:+-H "$host"} ${config:+--config "$config"} 2>/dev/null "$@" -} - -__docker_containers_all() { - local IFS=$'\n' - local containers=( $(__docker_q ps -aq --no-trunc) ) - if [ "$1" ]; then - containers=( $(__docker_q inspect --format "{{if $1}}{{.Id}}{{end}}" "${containers[@]}") ) - fi - local names=( $(__docker_q inspect --format '{{.Name}}' "${containers[@]}") ) - names=( "${names[@]#/}" ) # trim off the leading "/" from the container names - unset IFS - COMPREPLY=( $(compgen -W "${names[*]} ${containers[*]}" -- "$cur") ) -} - -__docker_containers_running() { - __docker_containers_all '.State.Running' -} - -__docker_containers_stopped() { - __docker_containers_all 'not .State.Running' -} - -__docker_containers_pauseable() { - __docker_containers_all 'and .State.Running (not .State.Paused)' -} - -__docker_containers_unpauseable() { - __docker_containers_all '.State.Paused' -} - -__docker_container_names() { - local containers=( $(__docker_q ps -aq --no-trunc) ) - local names=( $(__docker_q inspect --format '{{.Name}}' "${containers[@]}") ) - names=( "${names[@]#/}" ) # trim off the leading "/" from the container names - COMPREPLY=( $(compgen -W "${names[*]}" -- "$cur") ) -} - -__docker_container_ids() { - local containers=( $(__docker_q ps -aq) ) - COMPREPLY=( $(compgen -W "${containers[*]}" -- "$cur") ) -} - -__docker_images() { - local images_args="" - - case "$DOCKER_COMPLETION_SHOW_IMAGE_IDS" in - all) - images_args="--no-trunc -a" - ;; - non-intermediate) - images_args="--no-trunc" - ;; - esac - - local repo_print_command - if [ "${DOCKER_COMPLETION_SHOW_TAGS:-yes}" = "yes" ]; then - repo_print_command='print $1; print $1":"$2' - else - repo_print_command='print $1' - fi - - local awk_script - case "$DOCKER_COMPLETION_SHOW_IMAGE_IDS" in - all|non-intermediate) - awk_script='NR>1 { print $3; if ($1 != "") { '"$repo_print_command"' } }' - ;; - none|*) - awk_script='NR>1 && $1 != "" { '"$repo_print_command"' }' - ;; - esac - - local images=$(__docker_q images $images_args | awk "$awk_script") - COMPREPLY=( $(compgen -W "$images" -- "$cur") ) - __ltrim_colon_completions "$cur" -} - -__docker_image_repos() { - local repos="$(__docker_q images | awk 'NR>1 && $1 != "" { print $1 }')" - COMPREPLY=( $(compgen -W "$repos" -- "$cur") ) -} - -__docker_image_repos_and_tags() { - local reposAndTags="$(__docker_q images | awk 'NR>1 && $1 != "" { print $1; print $1":"$2 }')" - COMPREPLY=( $(compgen -W "$reposAndTags" -- "$cur") ) - __ltrim_colon_completions "$cur" -} - -__docker_containers_and_images() { - __docker_containers_all - local containers=( "${COMPREPLY[@]}" ) - __docker_images - COMPREPLY+=( "${containers[@]}" ) -} - -# Finds the position of the first word that is neither option nor an option's argument. -# If there are options that require arguments, you should pass a glob describing those -# options, e.g. "--option1|-o|--option2" -# Use this function to restrict completions to exact positions after the argument list. -__docker_pos_first_nonflag() { - local argument_flags=$1 - - local counter=$((command_pos + 1)) - while [ $counter -le $cword ]; do - if [ -n "$argument_flags" ] && eval "case '${words[$counter]}' in $argument_flags) true ;; *) false ;; esac"; then - (( counter++ )) - # eat "=" in case of --option=arg syntax - [ "${words[$counter]}" = "=" ] && (( counter++ )) - else - case "${words[$counter]}" in - -*) - ;; - *) - break - ;; - esac - fi - - # Bash splits words at "=", retaining "=" as a word, examples: - # "--debug=false" => 3 words, "--log-opt syslog-facility=daemon" => 4 words - while [ "${words[$counter + 1]}" = "=" ] ; do - counter=$(( counter + 2)) - done - - (( counter++ )) - done - - echo $counter -} - -# Returns the value of the first option matching option_glob. -# Valid values for option_glob are option names like '--log-level' and -# globs like '--log-level|-l' -# Only positions between the command and the current word are considered. -__docker_value_of_option() { - local option_glob=$1 - - local counter=$((command_pos + 1)) - while [ $counter -lt $cword ]; do - case ${words[$counter]} in - @($option_glob) ) - echo ${words[$counter + 1]} - break - ;; - esac - (( counter++ )) - done -} - -# Transforms a multiline list of strings into a single line string -# with the words separated by "|". -# This is used to prepare arguments to __docker_pos_first_nonflag(). -__docker_to_alternatives() { - local parts=( $1 ) - local IFS='|' - echo "${parts[*]}" -} - -# Transforms a multiline list of options into an extglob pattern -# suitable for use in case statements. -__docker_to_extglob() { - local extglob=$( __docker_to_alternatives "$1" ) - echo "@($extglob)" -} - -__docker_resolve_hostname() { - command -v host >/dev/null 2>&1 || return - COMPREPLY=( $(host 2>/dev/null "${cur%:}" | awk '/has address/ {print $4}') ) -} - -__docker_capabilities() { - # The list of capabilities is defined in types.go, ALL was added manually. - COMPREPLY=( $( compgen -W " - ALL - AUDIT_CONTROL - AUDIT_WRITE - AUDIT_READ - BLOCK_SUSPEND - CHOWN - DAC_OVERRIDE - DAC_READ_SEARCH - FOWNER - FSETID - IPC_LOCK - IPC_OWNER - KILL - LEASE - LINUX_IMMUTABLE - MAC_ADMIN - MAC_OVERRIDE - MKNOD - NET_ADMIN - NET_BIND_SERVICE - NET_BROADCAST - NET_RAW - SETFCAP - SETGID - SETPCAP - SETUID - SYS_ADMIN - SYS_BOOT - SYS_CHROOT - SYSLOG - SYS_MODULE - SYS_NICE - SYS_PACCT - SYS_PTRACE - SYS_RAWIO - SYS_RESOURCE - SYS_TIME - SYS_TTY_CONFIG - WAKE_ALARM - " -- "$cur" ) ) -} - -__docker_log_drivers() { - COMPREPLY=( $( compgen -W " - fluentd - gelf - journald - json-file - none - syslog - " -- "$cur" ) ) -} - -__docker_log_driver_options() { - # see docs/reference/logging/index.md - local fluentd_options="fluentd-address fluentd-tag" - local gelf_options="gelf-address gelf-tag" - local json_file_options="max-file max-size" - local syslog_options="syslog-address syslog-facility syslog-tag" - - case $(__docker_value_of_option --log-driver) in - '') - COMPREPLY=( $( compgen -W "$fluentd_options $gelf_options $json_file_options $syslog_options" -S = -- "$cur" ) ) - ;; - fluentd) - COMPREPLY=( $( compgen -W "$fluentd_options" -S = -- "$cur" ) ) - ;; - gelf) - COMPREPLY=( $( compgen -W "$gelf_options" -S = -- "$cur" ) ) - ;; - json-file) - COMPREPLY=( $( compgen -W "$json_file_options" -S = -- "$cur" ) ) - ;; - syslog) - COMPREPLY=( $( compgen -W "$syslog_options" -S = -- "$cur" ) ) - ;; - *) - return - ;; - esac - - compopt -o nospace -} - -__docker_complete_log_driver_options() { - # "=" gets parsed to a word and assigned to either $cur or $prev depending on whether - # it is the last character or not. So we search for "xxx=" in the the last two words. - case "${words[$cword-2]}$prev=" in - *gelf-address=*) - COMPREPLY=( $( compgen -W "udp" -S "://" -- "${cur#=}" ) ) - compopt -o nospace - return - ;; - *syslog-address=*) - COMPREPLY=( $( compgen -W "tcp udp unix" -S "://" -- "${cur#=}" ) ) - compopt -o nospace - return - ;; - *syslog-facility=*) - COMPREPLY=( $( compgen -W " - auth - authpriv - cron - daemon - ftp - kern - local0 - local1 - local2 - local3 - local4 - local5 - local6 - local7 - lpr - mail - news - syslog - user - uucp - " -- "${cur#=}" ) ) - return - ;; - esac - return 1 -} - -__docker_log_levels() { - COMPREPLY=( $( compgen -W "debug info warn error fatal" -- "$cur" ) ) -} - -# a selection of the available signals that is most likely of interest in the -# context of docker containers. -__docker_signals() { - local signals=( - SIGCONT - SIGHUP - SIGINT - SIGKILL - SIGQUIT - SIGSTOP - SIGTERM - SIGUSR1 - SIGUSR2 - ) - COMPREPLY=( $( compgen -W "${signals[*]} ${signals[*]#SIG}" -- "$( echo $cur | tr '[:lower:]' '[:upper:]')" ) ) -} - -# global options that may appear after the docker command -_docker_docker() { - local boolean_options=" - $global_boolean_options - --help - --version -v - " - - case "$prev" in - --config) - _filedir -d - return - ;; - --log-level|-l) - __docker_log_levels - return - ;; - $(__docker_to_extglob "$global_options_with_args") ) - return - ;; - esac - - case "$cur" in - -*) - COMPREPLY=( $( compgen -W "$boolean_options $global_options_with_args" -- "$cur" ) ) - ;; - *) - local counter=$( __docker_pos_first_nonflag $(__docker_to_extglob "$global_options_with_args") ) - if [ $cword -eq $counter ]; then - COMPREPLY=( $( compgen -W "${commands[*]} help" -- "$cur" ) ) - fi - ;; - esac -} - -_docker_attach() { - case "$cur" in - -*) - COMPREPLY=( $( compgen -W "--help --no-stdin --sig-proxy" -- "$cur" ) ) - ;; - *) - local counter="$(__docker_pos_first_nonflag)" - if [ $cword -eq $counter ]; then - __docker_containers_running - fi - ;; - esac -} - -_docker_build() { - case "$prev" in - --cgroup-parent|--cpuset-cpus|--cpuset-mems|--cpu-shares|-c|--cpu-period|--cpu-quota|--memory|-m|--memory-swap) - return - ;; - --file|-f) - _filedir - return - ;; - --tag|-t) - __docker_image_repos_and_tags - return - ;; - esac - - case "$cur" in - -*) - COMPREPLY=( $( compgen -W "--cgroup-parent --cpuset-cpus --cpuset-mems --cpu-shares -c --cpu-period --cpu-quota --file -f --force-rm --help --memory -m --memory-swap --no-cache --pull --quiet -q --rm --tag -t --ulimit" -- "$cur" ) ) - ;; - *) - local counter="$(__docker_pos_first_nonflag '--cgroup-parent|--cpuset-cpus|--cpuset-mems|--cpu-shares|-c|--cpu-period|--cpu-quota|--file|-f|--memory|-m|--memory-swap|--tag|-t')" - if [ $cword -eq $counter ]; then - _filedir -d - fi - ;; - esac -} - -_docker_commit() { - case "$prev" in - --author|-a|--change|-c|--message|-m) - return - ;; - esac - - case "$cur" in - -*) - COMPREPLY=( $( compgen -W "--author -a --change -c --help --message -m --pause -p" -- "$cur" ) ) - ;; - *) - local counter=$(__docker_pos_first_nonflag '--author|-a|--change|-c|--message|-m') - - if [ $cword -eq $counter ]; then - __docker_containers_all - return - fi - (( counter++ )) - - if [ $cword -eq $counter ]; then - __docker_image_repos_and_tags - return - fi - ;; - esac -} - -_docker_cp() { - case "$cur" in - -*) - COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) - ;; - *) - local counter=$(__docker_pos_first_nonflag) - if [ $cword -eq $counter ]; then - case "$cur" in - *:) - return - ;; - *) - __docker_containers_all - COMPREPLY=( $( compgen -W "${COMPREPLY[*]}" -S ':' ) ) - compopt -o nospace - return - ;; - esac - fi - (( counter++ )) - - if [ $cword -eq $counter ]; then - _filedir -d - return - fi - ;; - esac -} - -_docker_create() { - _docker_run -} - -_docker_daemon() { - local boolean_options=" - $global_boolean_options - --help - --icc=false - --ip-forward=false - --ip-masq=false - --iptables=false - --ipv6 - --selinux-enabled - --userland-proxy=false - " - local options_with_args=" - $global_options_with_args - --api-cors-header - --bip - --bridge -b - --default-gateway - --default-gateway-v6 - --default-ulimit - --dns - --dns-search - --exec-driver -e - --exec-opt - --exec-root - --fixed-cidr - --fixed-cidr-v6 - --graph -g - --group -G - --insecure-registry - --ip - --label - --log-driver - --log-opt - --mtu - --pidfile -p - --registry-mirror - --storage-driver -s - --storage-opt - " - - case "$prev" in - --exec-root|--graph|-g) - _filedir -d - return - ;; - --log-driver) - __docker_log_drivers - return - ;; - --pidfile|-p|--tlscacert|--tlscert|--tlskey) - _filedir - return - ;; - --storage-driver|-s) - COMPREPLY=( $( compgen -W "aufs btrfs devicemapper overlay vfs zfs" -- "$(echo $cur | tr '[:upper:]' '[:lower:]')" ) ) - return - ;; - --storage-opt) - local devicemapper_options=" - dm.basesize - dm.blkdiscard - dm.blocksize - dm.fs - dm.loopdatasize - dm.loopmetadatasize - dm.mkfsarg - dm.mountopt - dm.override_udev_sync_check - dm.thinpooldev - " - local zfs_options="zfs.fsname" - - case $(__docker_value_of_option '--storage-driver|-s') in - '') - COMPREPLY=( $( compgen -W "$devicemapper_options $zfs_options" -S = -- "$cur" ) ) - ;; - devicemapper) - COMPREPLY=( $( compgen -W "$devicemapper_options" -S = -- "$cur" ) ) - ;; - zfs) - COMPREPLY=( $( compgen -W "$zfs_options" -S = -- "$cur" ) ) - ;; - *) - return - ;; - esac - compopt -o nospace - return - ;; - --log-level|-l) - __docker_log_levels - return - ;; - --log-opt) - __docker_log_driver_options - return - ;; - $(__docker_to_extglob "$options_with_args") ) - return - ;; - esac - - __docker_complete_log_driver_options && return - - # completions for --storage-opt - case "${words[$cword-2]}$prev=" in - *dm.blkdiscard=*) - COMPREPLY=( $( compgen -W "false true" -- "${cur#=}" ) ) - return - ;; - *dm.fs=*) - COMPREPLY=( $( compgen -W "ext4 xfs" -- "${cur#=}" ) ) - return - ;; - *dm.override_udev_sync_check=*) - COMPREPLY=( $( compgen -W "false true" -- "${cur#=}" ) ) - return - ;; - *dm.thinpooldev=*) - _filedir - return - ;; - esac - - case "$cur" in - -*) - COMPREPLY=( $( compgen -W "$boolean_options $options_with_args" -- "$cur" ) ) - ;; - esac -} - -_docker_diff() { - case "$cur" in - -*) - COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) - ;; - *) - local counter=$(__docker_pos_first_nonflag) - if [ $cword -eq $counter ]; then - __docker_containers_all - fi - ;; - esac -} - -_docker_events() { - case "$prev" in - --filter|-f) - COMPREPLY=( $( compgen -S = -W "container event image" -- "$cur" ) ) - compopt -o nospace - return - ;; - --since|--until) - return - ;; - esac - - case "${words[$cword-2]}$prev=" in - *container=*) - cur="${cur#=}" - __docker_containers_all - return - ;; - *event=*) - COMPREPLY=( $( compgen -W " - attach - commit - copy - create - delete - destroy - die - exec_create - exec_start - export - import - kill - oom - pause - pull - push - rename - resize - restart - start - stop - tag - top - unpause - untag - " -- "${cur#=}" ) ) - return - ;; - *image=*) - cur="${cur#=}" - __docker_images - return - ;; - esac - - case "$cur" in - -*) - COMPREPLY=( $( compgen -W "--filter -f --help --since --until" -- "$cur" ) ) - ;; - esac -} - -_docker_exec() { - case "$prev" in - --user|-u) - return - ;; - esac - - case "$cur" in - -*) - COMPREPLY=( $( compgen -W "--detach -d --help --interactive -i --privileged -t --tty -u --user" -- "$cur" ) ) - ;; - *) - __docker_containers_running - ;; - esac -} - -_docker_export() { - case "$cur" in - -*) - COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) - ;; - *) - local counter=$(__docker_pos_first_nonflag) - if [ $cword -eq $counter ]; then - __docker_containers_all - fi - ;; - esac -} - -_docker_help() { - local counter=$(__docker_pos_first_nonflag) - if [ $cword -eq $counter ]; then - COMPREPLY=( $( compgen -W "${commands[*]}" -- "$cur" ) ) - fi -} - -_docker_history() { - case "$cur" in - -*) - COMPREPLY=( $( compgen -W "--help --no-trunc --quiet -q" -- "$cur" ) ) - ;; - *) - local counter=$(__docker_pos_first_nonflag) - if [ $cword -eq $counter ]; then - __docker_images - fi - ;; - esac -} - -_docker_images() { - case "$prev" in - --filter|-f) - COMPREPLY=( $( compgen -W "dangling=true label=" -- "$cur" ) ) - if [ "$COMPREPLY" = "label=" ]; then - compopt -o nospace - fi - return - ;; - esac - - case "${words[$cword-2]}$prev=" in - *dangling=*) - COMPREPLY=( $( compgen -W "true false" -- "${cur#=}" ) ) - return - ;; - *label=*) - return - ;; - esac - - case "$cur" in - -*) - COMPREPLY=( $( compgen -W "--all -a --digests --filter -f --help --no-trunc --quiet -q" -- "$cur" ) ) - ;; - =) - return - ;; - *) - __docker_image_repos - ;; - esac -} - -_docker_import() { - case "$cur" in - -*) - COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) - ;; - *) - local counter=$(__docker_pos_first_nonflag) - if [ $cword -eq $counter ]; then - return - fi - (( counter++ )) - - if [ $cword -eq $counter ]; then - __docker_image_repos_and_tags - return - fi - ;; - esac -} - -_docker_info() { - case "$cur" in - -*) - COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) - ;; - esac -} - -_docker_inspect() { - case "$prev" in - --format|-f) - return - ;; - --type) - COMPREPLY=( $( compgen -W "image container" -- "$cur" ) ) - return - ;; - - esac - - case "$cur" in - -*) - COMPREPLY=( $( compgen -W "--format -f --type --help" -- "$cur" ) ) - ;; - *) - case $(__docker_value_of_option --type) in - '') - __docker_containers_and_images - ;; - container) - __docker_containers_all - ;; - image) - __docker_images - ;; - esac - esac -} - -_docker_kill() { - case "$prev" in - --signal|-s) - __docker_signals - return - ;; - esac - - case "$cur" in - -*) - COMPREPLY=( $( compgen -W "--help --signal -s" -- "$cur" ) ) - ;; - *) - __docker_containers_running - ;; - esac -} - -_docker_load() { - case "$prev" in - --input|-i) - _filedir - return - ;; - esac - - case "$cur" in - -*) - COMPREPLY=( $( compgen -W "--help --input -i" -- "$cur" ) ) - ;; - esac -} - -_docker_login() { - case "$prev" in - --email|-e|--password|-p|--username|-u) - return - ;; - esac - - case "$cur" in - -*) - COMPREPLY=( $( compgen -W "--email -e --help --password -p --username -u" -- "$cur" ) ) - ;; - esac -} - -_docker_logout() { - case "$cur" in - -*) - COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) - ;; - esac -} - -_docker_logs() { - case "$prev" in - --since|--tail) - return - ;; - esac - - case "$cur" in - -*) - COMPREPLY=( $( compgen -W "--follow -f --help --since --tail --timestamps -t" -- "$cur" ) ) - ;; - *) - local counter=$(__docker_pos_first_nonflag '--tail') - if [ $cword -eq $counter ]; then - __docker_containers_all - fi - ;; - esac -} - -_docker_pause() { - case "$cur" in - -*) - COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) - ;; - *) - local counter=$(__docker_pos_first_nonflag) - if [ $cword -eq $counter ]; then - __docker_containers_pauseable - fi - ;; - esac -} - -_docker_port() { - case "$cur" in - -*) - COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) - ;; - *) - local counter=$(__docker_pos_first_nonflag) - if [ $cword -eq $counter ]; then - __docker_containers_all - fi - ;; - esac -} - -_docker_ps() { - case "$prev" in - --before|--since) - __docker_containers_all - ;; - --filter|-f) - COMPREPLY=( $( compgen -S = -W "ancestor exited id label name status" -- "$cur" ) ) - compopt -o nospace - return - ;; - --format|-n) - return - ;; - esac - - case "${words[$cword-2]}$prev=" in - *ancestor=*) - cur="${cur#=}" - __docker_images - return - ;; - *id=*) - cur="${cur#=}" - __docker_container_ids - return - ;; - *name=*) - cur="${cur#=}" - __docker_container_names - return - ;; - *status=*) - COMPREPLY=( $( compgen -W "exited paused restarting running" -- "${cur#=}" ) ) - return - ;; - esac - - case "$cur" in - -*) - COMPREPLY=( $( compgen -W "--all -a --before --filter -f --format --help --latest -l -n --no-trunc --quiet -q --size -s --since" -- "$cur" ) ) - ;; - esac -} - -_docker_pull() { - case "$cur" in - -*) - COMPREPLY=( $( compgen -W "--all-tags -a --help" -- "$cur" ) ) - ;; - *) - local counter=$(__docker_pos_first_nonflag) - if [ $cword -eq $counter ]; then - for arg in "${COMP_WORDS[@]}"; do - case "$arg" in - --all-tags|-a) - __docker_image_repos - return - ;; - esac - done - __docker_image_repos_and_tags - fi - ;; - esac -} - -_docker_push() { - case "$cur" in - -*) - COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) - ;; - *) - local counter=$(__docker_pos_first_nonflag) - if [ $cword -eq $counter ]; then - __docker_image_repos_and_tags - fi - ;; - esac -} - -_docker_rename() { - case "$cur" in - -*) - COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) - ;; - *) - local counter=$(__docker_pos_first_nonflag) - if [ $cword -eq $counter ]; then - __docker_containers_all - fi - ;; - esac -} - -_docker_restart() { - case "$prev" in - --time|-t) - return - ;; - esac - - case "$cur" in - -*) - COMPREPLY=( $( compgen -W "--help --time -t" -- "$cur" ) ) - ;; - *) - __docker_containers_all - ;; - esac -} - -_docker_rm() { - case "$cur" in - -*) - COMPREPLY=( $( compgen -W "--force -f --help --link -l --volumes -v" -- "$cur" ) ) - ;; - *) - for arg in "${COMP_WORDS[@]}"; do - case "$arg" in - --force|-f) - __docker_containers_all - return - ;; - esac - done - __docker_containers_stopped - ;; - esac -} - -_docker_rmi() { - case "$cur" in - -*) - COMPREPLY=( $( compgen -W "--force -f --help --no-prune" -- "$cur" ) ) - ;; - *) - __docker_images - ;; - esac -} - -_docker_run() { - local options_with_args=" - --add-host - --attach -a - --blkio-weight - --cap-add - --cap-drop - --cgroup-parent - --cidfile - --cpu-period - --cpu-quota - --cpuset-cpus - --cpuset-mems - --cpu-shares -c - --device - --dns - --dns-search - --entrypoint - --env -e - --env-file - --expose - --group-add - --hostname -h - --ipc - --kernel-memory - --label-file - --label -l - --link - --log-driver - --log-opt - --lxc-conf - --mac-address - --memory -m - --memory-swap - --memory-swappiness - --name - --net - --pid - --publish -p - --restart - --security-opt - --ulimit - --user -u - --uts - --volumes-from - --volume -v - --workdir -w - " - - local all_options="$options_with_args - --disable-content-trust=false - --help - --interactive -i - --oom-kill-disable - --privileged - --publish-all -P - --read-only - --tty -t - " - - [ "$command" = "run" ] && all_options="$all_options - --detach -d - --rm - --sig-proxy=false - " - - local options_with_args_glob=$(__docker_to_extglob "$options_with_args") - - case "$prev" in - --add-host) - case "$cur" in - *:) - __docker_resolve_hostname - return - ;; - esac - ;; - --attach|-a) - COMPREPLY=( $( compgen -W 'stdin stdout stderr' -- "$cur" ) ) - return - ;; - --cap-add|--cap-drop) - __docker_capabilities - return - ;; - --cidfile|--env-file|--label-file) - _filedir - return - ;; - --device|--volume|-v) - case "$cur" in - *:*) - # TODO somehow do _filedir for stuff inside the image, if it's already specified (which is also somewhat difficult to determine) - ;; - '') - COMPREPLY=( $( compgen -W '/' -- "$cur" ) ) - compopt -o nospace - ;; - /*) - _filedir - compopt -o nospace - ;; - esac - return - ;; - --env|-e) - COMPREPLY=( $( compgen -e -- "$cur" ) ) - compopt -o nospace - return - ;; - --ipc) - case "$cur" in - *:*) - cur="${cur#*:}" - __docker_containers_running - ;; - *) - COMPREPLY=( $( compgen -W 'host container:' -- "$cur" ) ) - if [ "$COMPREPLY" = "container:" ]; then - compopt -o nospace - fi - ;; - esac - return - ;; - --link) - case "$cur" in - *:*) - ;; - *) - __docker_containers_running - COMPREPLY=( $( compgen -W "${COMPREPLY[*]}" -S ':' ) ) - compopt -o nospace - ;; - esac - return - ;; - --log-driver) - __docker_log_drivers - return - ;; - --log-opt) - __docker_log_driver_options - return - ;; - --net) - case "$cur" in - container:*) - local cur=${cur#*:} - __docker_containers_all - ;; - *) - COMPREPLY=( $( compgen -W "bridge none container: host" -- "$cur") ) - if [ "${COMPREPLY[*]}" = "container:" ] ; then - compopt -o nospace - fi - ;; - esac - return - ;; - --restart) - case "$cur" in - on-failure:*) - ;; - *) - COMPREPLY=( $( compgen -W "no on-failure on-failure: always" -- "$cur") ) - ;; - esac - return - ;; - --security-opt) - case "$cur" in - label:*:*) - ;; - label:*) - local cur=${cur##*:} - COMPREPLY=( $( compgen -W "user: role: type: level: disable" -- "$cur") ) - if [ "${COMPREPLY[*]}" != "disable" ] ; then - compopt -o nospace - fi - ;; - *) - COMPREPLY=( $( compgen -W "label apparmor" -S ":" -- "$cur") ) - compopt -o nospace - ;; - esac - return - ;; - --volumes-from) - __docker_containers_all - return - ;; - $options_with_args_glob ) - return - ;; - esac - - __docker_complete_log_driver_options && return - - case "$cur" in - -*) - COMPREPLY=( $( compgen -W "$all_options" -- "$cur" ) ) - ;; - *) - local counter=$( __docker_pos_first_nonflag $( __docker_to_alternatives "$options_with_args" ) ) - if [ $cword -eq $counter ]; then - __docker_images - fi - ;; - esac -} - -_docker_save() { - case "$prev" in - --output|-o) - _filedir - return - ;; - esac - - case "$cur" in - -*) - COMPREPLY=( $( compgen -W "--help --output -o" -- "$cur" ) ) - ;; - *) - __docker_images - ;; - esac -} - -_docker_search() { - case "$prev" in - --stars|-s) - return - ;; - esac - - case "$cur" in - -*) - COMPREPLY=( $( compgen -W "--automated --help --no-trunc --stars -s" -- "$cur" ) ) - ;; - esac -} - -_docker_start() { - case "$cur" in - -*) - COMPREPLY=( $( compgen -W "--attach -a --help --interactive -i" -- "$cur" ) ) - ;; - *) - __docker_containers_stopped - ;; - esac -} - -_docker_stats() { - case "$cur" in - -*) - COMPREPLY=( $( compgen -W "--no-stream --help" -- "$cur" ) ) - ;; - *) - __docker_containers_running - ;; - esac -} - -_docker_stop() { - case "$prev" in - --time|-t) - return - ;; - esac - - case "$cur" in - -*) - COMPREPLY=( $( compgen -W "--help --time -t" -- "$cur" ) ) - ;; - *) - __docker_containers_running - ;; - esac -} - -_docker_tag() { - case "$cur" in - -*) - COMPREPLY=( $( compgen -W "--force -f --help" -- "$cur" ) ) - ;; - *) - local counter=$(__docker_pos_first_nonflag) - - if [ $cword -eq $counter ]; then - __docker_image_repos_and_tags - return - fi - (( counter++ )) - - if [ $cword -eq $counter ]; then - __docker_image_repos_and_tags - return - fi - ;; - esac -} - -_docker_unpause() { - case "$cur" in - -*) - COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) - ;; - *) - local counter=$(__docker_pos_first_nonflag) - if [ $cword -eq $counter ]; then - __docker_containers_unpauseable - fi - ;; - esac -} - -_docker_top() { - case "$cur" in - -*) - COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) - ;; - *) - local counter=$(__docker_pos_first_nonflag) - if [ $cword -eq $counter ]; then - __docker_containers_running - fi - ;; - esac -} - -_docker_version() { - case "$cur" in - -*) - COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) - ;; - esac -} - -_docker_wait() { - case "$cur" in - -*) - COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) - ;; - *) - __docker_containers_all - ;; - esac -} - -_docker() { - local previous_extglob_setting=$(shopt -p extglob) - shopt -s extglob - - local commands=( - attach - build - commit - cp - create - daemon - diff - events - exec - export - history - images - import - info - inspect - kill - load - login - logout - logs - pause - port - ps - pull - push - rename - restart - rm - rmi - run - save - search - start - stats - stop - tag - top - unpause - version - wait - ) - - # These options are valid as global options for all client commands - # and valid as command options for `docker daemon` - local global_boolean_options=" - --debug -D - --tls - --tlsverify - " - local global_options_with_args=" - --config - --host -H - --log-level -l - --tlscacert - --tlscert - --tlskey - " - - local host config - - COMPREPLY=() - local cur prev words cword - _get_comp_words_by_ref -n : cur prev words cword - - local command='docker' command_pos=0 - local counter=1 - while [ $counter -lt $cword ]; do - case "${words[$counter]}" in - # save host so that completion can use custom daemon - --host|-H) - (( counter++ )) - host="${words[$counter]}" - ;; - # save config so that completion can use custom configuration directories - --config) - (( counter++ )) - config="${words[$counter]}" - ;; - $(__docker_to_extglob "$global_options_with_args") ) - (( counter++ )) - ;; - -*) - ;; - =) - (( counter++ )) - ;; - *) - command="${words[$counter]}" - command_pos=$counter - break - ;; - esac - (( counter++ )) - done - - local completions_func=_docker_${command} - declare -F $completions_func >/dev/null && $completions_func - - eval "$previous_extglob_setting" - return 0 -} - -complete -F _docker docker diff --git a/home/.bash_aliases b/home/.bash_aliases index 3c26525..475506a 100644 --- a/home/.bash_aliases +++ b/home/.bash_aliases @@ -21,6 +21,14 @@ alias a=ansible alias c=code-insiders alias e=$EDITOR +# Completion for aliases +# See: https://github.com/cykerway/complete-alias +complete -F _complete_alias g +complete -F _complete_alias k +complete -F _complete_alias a +complete -F _complete_alias c +complete -F _complete_alias e + # Some shortcuts for me function moby() { [ -f ~/.bash_env ] && source ~/.bash_env diff --git a/home/.bash_completion b/home/.bash_completion index b8ea7e8..2178a59 100644 --- a/home/.bash_completion +++ b/home/.bash_completion @@ -30,7 +30,8 @@ if type ykman > /dev/null 2>&1; then _ykman_completionetup; fi -if command -v brew; then +# Homebrew completions +if command -v brew > /dev/null; then HOMEBREW_PREFIX=$(brew --prefix) if type brew &>/dev/null; then for COMPLETION in "$HOMEBREW_PREFIX"/etc/bash_completion.d/*; do @@ -41,3 +42,12 @@ if command -v brew; then fi fi fi + +# Docker completions +for COMPLETION in /Applications/Docker.app/Contents/Resources/etc/*.bash-completion; do + [ -f ${COMPLETION} ] && source ${COMPLETION} +done + +# Add completion to aliases +# See: https://github.com/cykerway/complete-alias +source ~/.homesick/repos/complete-alias/bash_completion.sh diff --git a/home/.bash_env b/home/.bash_env index f1f9c6b..40006b0 100644 --- a/home/.bash_env +++ b/home/.bash_env @@ -21,15 +21,18 @@ if [[ "${OSTYPE}" == "darwin"* ]]; then export PATH=/usr/local/MacGPG2/bin/:${PATH} fi - # Macports man-pages - if [ -d /opt/local/share/man ]; then - export MANPATH=/opt/local/share/man:${MANPATH} + # Homebrew man-pages + if [ -d /usr/local/share/man ]; then + export MANPATH=/usr/local/share/man:${MANPATH} + export MANPATH=$(brew --prefix coreutils)/opt/coreutils/libexec/gnuman:${MANPATH} fi # Linux man-pages if [ -d /opt/man-pages ]; then export MANPATH=/opt/man-pages:${MANPATH} fi + + PATH=$(brew --prefix coreutils)/libexec/gnubin:/usr/local/bin:$PATH fi if [ -r ~/.gpg-agent-info ]; then diff --git a/home/.bashrc b/home/.bashrc index 8de590b..e3041f2 100644 --- a/home/.bashrc +++ b/home/.bashrc @@ -27,10 +27,10 @@ if [ -x /usr/bin/lesspipe ]; then eval "$(lesspipe)"; fi source ~/.homesick/repos/homeshick/homeshick.sh source ~/.homesick/repos/homeshick/completions/homeshick-completion.bash -source ~/.bash_aliases source ~/.bash_env source ~/.bash_prompt source ~/.bash_completion +source ~/.bash_aliases # enable color support of ls and also add handy aliases if hash dircolors 2>/dev/null; then diff --git a/packages.sh b/packages.sh index 1d4d287..da04b3c 100755 --- a/packages.sh +++ b/packages.sh @@ -70,6 +70,29 @@ brew install \ ripgrep \ wget \ wireshark \ + binutils \ + diffutils \ + findutils --with-default-names \ + gawk \ + gnu-indent --with-default-names \ + gnu-sed --with-default-names \ + gnu-tar --with-default-names \ + gnu-which --with-default-names \ + gnutls \ + grep --with-default-names \ + gzip \ + screen \ + watch \ + wdiff --with-gettext \ + tmux \ + bash \ + gdb \ + gpatch \ + m4 \ + make \ + nano \ + less \ + rsync brew cask install \ meld