diff options
| author | Craig Jennings <c@cjennings.net> | 2026-06-01 23:43:46 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-06-01 23:43:46 -0500 |
| commit | 92a3be1085359dfb60d4861670398ee3f496fe99 (patch) | |
| tree | a16dea21bdc51f63dc655fb6f8e9c5172955ebfc /pearl.el | |
| parent | 8bae955521cdf3e2f8d5ff015b3ae36b5b8a75e8 (diff) | |
| download | pearl-92a3be1085359dfb60d4861670398ee3f496fe99.tar.gz pearl-92a3be1085359dfb60d4861670398ee3f496fe99.zip | |
feat(filter): multi-select states in the interactive builder
I made the builder's State prompt a completing-read-multiple, the way the Labels prompt already is, so you can pick several workflow states for one filter. The selection maps the way the spec describes: pick one and :state stays a scalar string, pick several and it becomes a list (state.name.in), pick none and there's no state constraint. The "[ Any. ]" sentinel is filtered out of the result like it is for labels.
Phase 2 of docs/multi-state-filter-spec.org. A stubbed-builder test covers the one/many/none mapping. Suite, compile, and lint green.
Diffstat (limited to 'pearl.el')
| -rw-r--r-- | pearl.el | 25 |
1 files changed, 17 insertions, 8 deletions
@@ -4168,15 +4168,24 @@ an id), or `pearl--filter-any' (any assignee, no scoping)." (team-id (and (not (pearl--filter-sentinel-value-p team-name)) (pearl--get-team-id-by-name team-name))) (open (pearl--read-yes-no "Open issues only? ")) + ;; Multi-select, like the Labels prompt: pick one or several states. + ;; One picked -> a string (`:state' scalar); several -> a list + ;; (`state.name.in'); none -> no state constraint. (state (and team-id - (let ((s (completing-read - "State: " - (pearl--completion-table-keep-order - (pearl--with-sentinel pearl--filter-any - (mapcar (lambda (st) (cdr (assoc 'name st))) - (pearl--team-states team-id)))) - nil t))) - (unless (pearl--filter-sentinel-value-p s) s)))) + (let ((picked + (cl-remove + pearl--filter-any + (completing-read-multiple + "States (comma-separated): " + (pearl--completion-table-keep-order + (pearl--with-sentinel pearl--filter-any + (mapcar (lambda (st) (cdr (assoc 'name st))) + (pearl--team-states team-id)))) + nil t) + :test #'string=))) + (cond ((null picked) nil) + ((= 1 (length picked)) (car picked)) + (t picked))))) (project (and team-id (let ((p (completing-read "Project: " |
