4 Commits
v0.1 ... v0.2.0

Author SHA1 Message Date
Ahmet Alp Balkan
5933a7bbf8 Add zsh completion script (finally)
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2017-04-26 09:39:24 -07:00
Ahmet Alp Balkan
a19b9535f6 Formula fixes
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2017-04-25 13:28:10 -07:00
Ahmet Alp Balkan
a861562803 Formula polishing
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2017-04-25 13:21:42 -07:00
Ahmet Alp Balkan
c4b6ad9517 Add a homebrew formula
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2017-04-25 12:58:58 -07:00
2 changed files with 30 additions and 0 deletions

18
Formula/kubectx.rb Normal file
View File

@@ -0,0 +1,18 @@
class Kubectx < Formula
desc "Tool that can switch between kubectl contexts easily and create aliases"
homepage "https://github.com/ahmetb/kubectx"
url "https://github.com/ahmetb/kubectx/archive/v0.2.0.tar.gz"
sha256 "9fb6557416e4be3ef7e9701527f89fa73a1a0545a3cafbe6bed7527061c6cfb7"
bottle :unneeded
def install
bin.install "kubectx"
bash_completion.install "completion/kubectx.bash" => "kubectx"
zsh_completion.install "completion/kubectx.zsh" => "_kubectx"
end
test do
system "which", "kubectx"
end
end

12
completion/kubectx.zsh Normal file
View File

@@ -0,0 +1,12 @@
#compdef kubectx
KUBECTX="${HOME}/.kube/kubectx"
PREV=""
if [ -f "$KUBECTX" ]; then
# show '-' only if there's a saved previous context
PREV=$(cat "${KUBECTX}")
_arguments "1: :((-\:Back\ to\ ${PREV} \
$(kubectl config get-contexts | awk '{print $2}' | tail -n +2)))"
else
_arguments "1: :($(kubectl config get-contexts | awk '{print $2}' | tail -n +2))"
fi