kubectl icon indicating copy to clipboard operation
kubectl copied to clipboard

Wrong type argument: commandp

Open d1egoaz opened this issue 4 years ago • 4 comments

Hey, thanks for this package, it looks it'd be a great fit for my workflow, however it is not working for me right now, not sure what's wrong :/

setup:

(setq kubectl--kubectl "/usr/local/bin/kubectl")
  1. kubectl-choose-context works
  2. kubectl--namespace-names works:
  3. When I choose a namespace I got this error:
/usr/local/bin/kubectl  --context xxxcontext get namespaces --no-headers=true | awk '{print $1}'
kubectl-choose-namespace: Wrong type argument: commandp, (keymap (81 . +format:region) (122 keymap (122 . +multiple-cursors/evil-mc-make-cursor-here) (117 . evil-mc-undo-last-added-cursor) (116 . +multiple-cursors/evil-mc-toggle-cursors) (113 . evil-mc-undo-all-cursors) (80 . evil-mc-make-and-goto-first-cursor) (112 . evil-mc-make-and-goto-prev-cursor) (78 . evil-mc-make-and-goto-last-cursor) (110 . evil-mc-make-and-goto-next-cursor) ...) (82 . +eval/buffer) (114 . +eval:region) (68 . +lookup/references) (100 . +lookup/definition) (45 . evil-numbers/dec-at-pt) (61 . evil-numbers/inc-at-pt) (121 . +evil:yank-unindented) ...)

d1egoaz avatar Jan 21 '20 13:01 d1egoaz

Thanks for reporting!

kubectl-choose-namespace ends by trying to invoke g on the current buffer (see here):

  (call-interactively (cdr (car (minor-mode-key-binding "g")))))

If it's invokes from kubectl-deployments, that should then load the deployments in that namespace. Is kubectl-deployments indeed what you started from?

jypma avatar Jan 22 '20 08:01 jypma

still failing for me.

I changed kubectl-choose-namespace to:

(defun kubectl-choose-namespace (namespace)
  "Select a new namespace interactively"
  (interactive (list (completing-read "Namespace: " (kubectl--namespace-names) nil t)))
  (setq kubectl--namespace namespace)
  (kubectl-pods-refresh))

and now I can see the pods list

d1egoaz avatar Jan 22 '20 14:01 d1egoaz

Nice find, thanks! Perhaps it's some incompatibility with evil?

The reason I wasn't "just" calling kubectl-pods-refresh, is that I wanted to be able to switch namespaces with the same function also in other views, e.g. when viewing a deployment. Do you think there'd be a better way to achieve that, than trying to simulate a press of g?

jypma avatar Jan 22 '20 14:01 jypma

Perhaps it's some incompatibility with evil?

looks like it!

Do you think there'd be a better way to achieve that, than trying to simulate a press of g?

let me have some time during the next days to read the code, don't expect too much from me, I'm not too familiar with elisp.

d1egoaz avatar Jan 22 '20 14:01 d1egoaz