Skip to content

Commit cd4f9df

Browse files
committed
kele-resource: hide the resource-specific suffixes section when empty
1 parent 2ff1928 commit cd4f9df

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

docs/references/changelog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ versioning][semver].
3636
`get` verb (e.g., `bindings`) (#81)
3737
- `kele-list` now correctly renders inapt for resources that don't support the
3838
`list` verb
39+
- `kele-resource` now no longer displays the resource-specific suffixes section if the chosen
40+
resource does not have any such suffix.
3941

4042
### Changed
4143

kele.el

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2382,6 +2382,18 @@ CONTEXT and NAMESPACE are used to identify where the deployment lives."
23822382
(kele--get-kind-for-plural kele--global-discovery-cache it)
23832383
(propertize it 'face 'warning))
23842384
(propertize "-specific actions" 'face 'transient-heading))))
2385+
:if
2386+
;; FIXME: We will need to generalize the :if logic here. As is, the :if logic here is coupled to
2387+
;; the definitions of the resource-specific actions themselves, meaning that any new action will
2388+
;; also need the :if conditional to be updated as well.
2389+
;;
2390+
;; One way to approach this would be to have an alist mapping kind -> resource-specific
2391+
;; suffixes.
2392+
(lambda ()
2393+
(let-alist (oref transient--prefix scope)
2394+
(or (-contains? kele--loggable-kinds .kind)
2395+
(-contains? kele--port-forwardable-kinds .kind)
2396+
(string-equal "deployments" .kind))))
23852397
(kele-resource-follow-logs)
23862398
(kele-port-forward)
23872399
(kele-deployment-restart)]]

0 commit comments

Comments
 (0)