1
0
mirror of https://codeberg.org/cage/tinmop/ synced 2025-02-08 07:08:39 +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 " ")
*standard-output*))
(build-options (all-options switch-prefix key)
(remove-if (lambda (a) (string= a switch-prefix))
(mapcar (lambda (a) (format nil
"~a~a"
switch-prefix
(getf a key "")))
all-options))))
(let ((compatible-options (mapcar (lambda (a) (getf a key))
(remove-if-not (lambda (a) (getf a key nil))
all-options))))
(mapcar (lambda (a)
(format nil "~a~a" switch-prefix a))
compatible-options))))
(let* ((all-options (options))
(long-options (build-options all-options "--" :long))
(short-options (build-options all-options "-" :short))
@ -175,10 +175,13 @@
(length words))
(let ((matched (sort (remove-if-not (lambda (a)
(cl-ppcre:scan (strcat "^"
(elt words words-index))
(elt words
words-index))
a))
options)
(lambda (a b) (< (length a) (length b))))))
(lambda (a b)
(< (length a)
(length b))))))
(if matched
(progn
(write-shell-array matched))