Skip to content

Commit

Permalink
don't push duplicate commands
Browse files Browse the repository at this point in the history
  • Loading branch information
snmsts committed Jul 30, 2024
1 parent 786a25f commit 80547e3
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions lib/main.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -260,14 +260,19 @@
(defun sub-command-filter (prefix)
(cdr
(or (gethash prefix *sub-command-filter*)
(let ((sub-commands
(loop for system-name in (remove-if-not
(string-start-with-filter prefix)
(asdf:registered-systems))
for command = (command system-name)
do (message :sub-commands "sub command candidate for ~S ~S ~A" prefix system-name command)
when command
collect command)))
(let ((sub-commands))
(loop with system-names = (remove-if-not
(string-start-with-filter prefix)
(asdf:registered-systems))
for system-name in system-names
for command = (command system-name)
do (message :sub-commands "sub command candidate for ~S ~S ~A" prefix system-name command)
when (and command
(not (find (clingon.command:command-name command)
sub-commands
:test 'equal
:key 'clingon.command:command-name)))
do (push command sub-commands))
(setf (gethash prefix *sub-command-filter*) (cons t sub-commands))))))

(defun sub-commands ()
Expand Down

0 comments on commit 80547e3

Please sign in to comment.