Skip to content

Commit

Permalink
Check for CRDs before listing them
Browse files Browse the repository at this point in the history
  • Loading branch information
femnad authored and evanlucas committed Sep 13, 2020
1 parent dadbc6e commit beca1e5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions completions/kubectl.fish
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ set __fish_kubectl_cached_crds ""
set __fish_kubectl_last_crd_fetch ""

function __fish_kubectl_actually_get_crds
if test (kubectl get crd --no-headers=true 2>/dev/null | wc -l) -eq 0
return
end
set __fish_kubectl_cached_crds (__fish_kubectl get crd -o jsonpath='{range .items[*]}{.spec.names.plural}{"\n"}{.spec.names.singular}{"\n"}{range .spec.names.shortNames[]}{@}{"\n"}{end}{end}')
set __fish_kubectl_last_crd_fetch (__fish_kubectl_get_current_time)
for i in $__fish_kubectl_cached_crds
Expand Down
3 changes: 3 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ set __fish_kubectl_cached_crds ""
set __fish_kubectl_last_crd_fetch ""
function __fish_kubectl_actually_get_crds
if test (kubectl get crd --no-headers=true 2>/dev/null | wc -l) -eq 0
return
end
set __fish_kubectl_cached_crds (__fish_kubectl get crd -o jsonpath='{range .items[*]}{.spec.names.plural}{"\n"}{.spec.names.singular}{"\n"}{range .spec.names.shortNames[]}{@}{"\n"}{end}{end}')
set __fish_kubectl_last_crd_fetch (__fish_kubectl_get_current_time)
for i in $__fish_kubectl_cached_crds
Expand Down

0 comments on commit beca1e5

Please sign in to comment.