bash_completions: Generic function for --filename arguments

This generic function adds --filename= arguments to commands, and does
the magic so they get bash completions to find json, yaml, or yml files.
This commit is contained in:
Eric Paris
2015-03-28 23:38:46 -04:00
parent 037407f49e
commit de3864a1c2
6 changed files with 70 additions and 4 deletions

View File

@@ -285,7 +285,11 @@ _kubectl_create()
flags_completion=()
flags+=("--filename=")
flags_with_completion+=("--filename")
flags_completion+=("_filedir '@(json|yaml|yml)'")
two_word_flags+=("-f")
flags_with_completion+=("-f")
flags_completion+=("_filedir '@(json|yaml|yml)'")
flags+=("--help")
flags+=("-h")
@@ -304,7 +308,11 @@ _kubectl_update()
flags_completion=()
flags+=("--filename=")
flags_with_completion+=("--filename")
flags_completion+=("_filedir '@(json|yaml|yml)'")
two_word_flags+=("-f")
flags_with_completion+=("-f")
flags_completion+=("_filedir '@(json|yaml|yml)'")
flags+=("--help")
flags+=("-h")
flags+=("--patch=")
@@ -325,7 +333,11 @@ _kubectl_delete()
flags+=("--all")
flags+=("--filename=")
flags_with_completion+=("--filename")
flags_completion+=("_filedir '@(json|yaml|yml)'")
two_word_flags+=("-f")
flags_with_completion+=("-f")
flags_completion+=("_filedir '@(json|yaml|yml)'")
flags+=("--help")
flags+=("-h")
flags+=("--selector=")
@@ -526,7 +538,11 @@ _kubectl_stop()
flags+=("--all")
flags+=("--filename=")
flags_with_completion+=("--filename")
flags_completion+=("_filedir '@(json|yaml|yml)'")
two_word_flags+=("-f")
flags_with_completion+=("-f")
flags_completion+=("_filedir '@(json|yaml|yml)'")
flags+=("--help")
flags+=("-h")
flags+=("--selector=")