Skip to content

Instantly share code, notes, and snippets.

@Eun
Last active February 11, 2020 08:57
Show Gist options
  • Select an option

  • Save Eun/65a916fc71e7bee48c87a2e443e11b12 to your computer and use it in GitHub Desktop.

Select an option

Save Eun/65a916fc71e7bee48c87a2e443e11b12 to your computer and use it in GitHub Desktop.

Revisions

  1. Eun revised this gist Feb 11, 2020. 1 changed file with 11 additions and 1 deletion.
    12 changes: 11 additions & 1 deletion kubesh.fish
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,13 @@
    # completion for kubesh
    # (put in ~/.config/fish/completions)
    complete -f -c kubesh -a '(kubectl get pods -o=jsonpath=\'{range .items[*]}{.metadata.name}{"\n"}{end}\')'
    function __kubesh_completion
    if test -n "$__kubesh_completion_cache_valid_until"; and test $__kubesh_completion_cache_valid_until -gt (date --utc +"%s")
    string join \n $__kubesh_completion_cache_content
    return
    end

    set -g __kubesh_completion_cache_valid_until (math (date --utc +"%s") + 10)
    set -g __kubesh_completion_cache_content (kubectl get pods -o=jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}')
    string join \n $__kubesh_completion_cache_content
    end
    complete -f -c kubesh -a '(__kubesh_completion)'
  2. Eun created this gist Feb 28, 2019.
    10 changes: 10 additions & 0 deletions kubesh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    #!/bin/bash
    if [ ${#@} -lt 1 ]; then
    echo "usage: kubesh <pod> [shell]"
    exit 1
    fi
    SHELL="sh"
    if [ ${#@} -gt 1 ]; then
    SHELL=${@:2}
    fi
    kubectl exec -ti ${1} ${SHELL}
    3 changes: 3 additions & 0 deletions kubesh.fish
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    # completion for kubesh
    # (put in ~/.config/fish/completions)
    complete -f -c kubesh -a '(kubectl get pods -o=jsonpath=\'{range .items[*]}{.metadata.name}{"\n"}{end}\')'