diff --git a/src/command-line.lisp b/src/command-line.lisp index 30ececf..affe4fb 100644 --- a/src/command-line.lisp +++ b/src/command-line.lisp @@ -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))