Skip to content

Commit

Permalink
fix: resource listing: allow empty list (#205)
Browse files Browse the repository at this point in the history
Closes #179.
  • Loading branch information
jinnovation authored Jun 4, 2024
1 parent 3582efa commit 8657600
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 2 additions & 0 deletions docs/references/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ versioning][semver].
- Fixed a bug where keybinding explanation "blurbs" in `kele-get` buffers don't
properly show the keybinding in clickable form
- Fixed a bug where keybindings in `kele-get-mode` are not actually bound
- Fixed a bug where empty results when listing resources e.g. for `kele-list` or
completion in `kele-get` results in false errors

### Changed

Expand Down
7 changes: 3 additions & 4 deletions kele.el
Original file line number Diff line number Diff line change
Expand Up @@ -1167,16 +1167,15 @@ If CONTEXT is not provided, use the current context."
kind)))
;; Block on proxy readiness
(proxy-get kele--global-proxy-manager ctx :wait t)
(if-let* ((data (kele--retry (lambda () (plz 'get url :as #'json-read))))
(filtered-items (->> (append (alist-get 'items data) '())
(if-let* ((data (kele--retry (lambda () (plz 'get url :as #'json-read)))))
(let ((filtered-items (->> (append (alist-get 'items data) '())
(-filter (lambda (item)
(if (not namespace) t
(let-alist item
(equal .metadata.namespace namespace))))))))
(progn
(setf (cdr (assoc 'items data)) filtered-items)
data)
;; FIXME: This might send false error if filtered-items ends up being empty

(signal 'error (format "Failed to fetch %s/%s/%s" group version kind)))))

(cl-defun kele--fetch-resource-names (group version kind &key namespace context)
Expand Down

0 comments on commit 8657600

Please sign in to comment.