From d7daa8af152e6ce6c2ed49232e077037735f838a Mon Sep 17 00:00:00 2001 From: Guillaume Berche Date: Thu, 11 Jul 2024 16:06:33 +0200 Subject: [PATCH 1/2] Create kubectl-get-in-shell.yaml Provide a way to continue working on the currently selected object in a new shell without doing lengthy copy/pastes --- plugins/kubectl-get-in-shell.yaml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 plugins/kubectl-get-in-shell.yaml diff --git a/plugins/kubectl-get-in-shell.yaml b/plugins/kubectl-get-in-shell.yaml new file mode 100644 index 0000000000..3d443a583a --- /dev/null +++ b/plugins/kubectl-get-in-shell.yaml @@ -0,0 +1,14 @@ +plugins: + kubectl-get-cmd: + shortCut: Shift-B + confirm: false + description: get into shell + scopes: + - all + command: bash + background: false + args: + - -c + - (printf "copy/paste in a shell:\n\n"; if [ "$NAMESPACE" != "" -a "$NAMESPACE" != "-" ]; then printf "kubectl get --context $CONTEXT -n $NAMESPACE $RESOURCE_NAME $NAME \n" ; else printf "kubectl get --context $CONTEXT $RESOURCE_NAME $NAME \n"; fi ) |& less + + From dd8de0660fcc7ac9b4d7c9217e5e407ab2cb6824 Mon Sep 17 00:00:00 2001 From: Guillaume Berche Date: Thu, 11 Jul 2024 16:12:12 +0200 Subject: [PATCH 2/2] Update kubectl-get-in-shell.yaml Refine comment --- plugins/kubectl-get-in-shell.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/kubectl-get-in-shell.yaml b/plugins/kubectl-get-in-shell.yaml index 3d443a583a..047b959021 100644 --- a/plugins/kubectl-get-in-shell.yaml +++ b/plugins/kubectl-get-in-shell.yaml @@ -1,4 +1,6 @@ plugins: + # provides a way to continue working on the currently selected object in a new shell without doing lengthy copy/paste of current context. + # It simply formats the `kubectl get` command, taking care to omit -n when the namespace is not defined (typically for cluster-wide resources) kubectl-get-cmd: shortCut: Shift-B confirm: false