1
0
mirror of https://codeberg.org/cage/tinmop/ synced 2025-02-10 07:20:35 +01:00

- cleaned up bash completion procedures.

This commit is contained in:
cage 2024-08-25 20:19:28 +02:00
parent 38988b76a0
commit 51cc86cf42

View File

@ -155,12 +155,12 @@
(write-sequence (text-utils:join-with-strings sequence " ") (write-sequence (text-utils:join-with-strings sequence " ")
*standard-output*)) *standard-output*))
(build-options (all-options switch-prefix key) (build-options (all-options switch-prefix key)
(remove-if (lambda (a) (string= a switch-prefix)) (let ((compatible-options (mapcar (lambda (a) (getf a key))
(mapcar (lambda (a) (format nil (remove-if-not (lambda (a) (getf a key nil))
"~a~a" all-options))))
switch-prefix (mapcar (lambda (a)
(getf a key ""))) (format nil "~a~a" switch-prefix a))
all-options)))) compatible-options))))
(let* ((all-options (options)) (let* ((all-options (options))
(long-options (build-options all-options "--" :long)) (long-options (build-options all-options "--" :long))
(short-options (build-options all-options "-" :short)) (short-options (build-options all-options "-" :short))
@ -175,10 +175,13 @@
(length words)) (length words))
(let ((matched (sort (remove-if-not (lambda (a) (let ((matched (sort (remove-if-not (lambda (a)
(cl-ppcre:scan (strcat "^" (cl-ppcre:scan (strcat "^"
(elt words words-index)) (elt words
words-index))
a)) a))
options) options)
(lambda (a b) (< (length a) (length b)))))) (lambda (a b)
(< (length a)
(length b))))))
(if matched (if matched
(progn (progn
(write-shell-array matched)) (write-shell-array matched))