Skip to content

Instantly share code, notes, and snippets.

@eparis
Created September 3, 2015 20:36
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eparis/fd17b8fb4eb58efc2c12 to your computer and use it in GitHub Desktop.
Save eparis/fd17b8fb4eb58efc2c12 to your computer and use it in GitHub Desktop.
Patch to make bash completions work on Macs
diff --git a/contrib/completions/bash/kubectl b/contrib/completions/bash/kubectl
index c096937..8bc3410 100644
--- a/contrib/completions/bash/kubectl
+++ b/contrib/completions/bash/kubectl
@@ -1,5 +1,10 @@
#!/bin/bash
+__my_init_completion()
+{
+ COMPREPLY=()
+ _get_comp_words_by_ref cur prev words cword
+}
__debug()
{
@@ -1180,7 +1185,11 @@ _kubectl()
__start_kubectl()
{
local cur prev words cword
- _init_completion -s || return
+ if declare -F _init_completions >/dev/null 2>&1; then
+ _init_completion
+ else
+ __my_init_completion
+ fi
local c=0
local flags=()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment