Adjust sorting of format help output
This commit is contained in:
@ -473,7 +473,7 @@ list of trash directories that were present in INFOS."
|
||||
(clingon:make-option
|
||||
:flag
|
||||
:key :quiet
|
||||
:description "suppress print matches (use with -t)"
|
||||
:description "don't print matches (use with -t)"
|
||||
:short-name #\q
|
||||
:long-name "quiet"))))
|
||||
|
||||
|
||||
@ -156,7 +156,7 @@ instead."
|
||||
:type string
|
||||
:initform ""
|
||||
:documentation "The used-passed format string."))
|
||||
(:default-initargs :parameter "FORMAT-CONTROL")
|
||||
(:default-initargs :parameter "FORMAT")
|
||||
(:documentation "Option that takes a format string."))
|
||||
|
||||
(defmethod clingon:initialize-option ((option option-format-string) &key)
|
||||
@ -231,6 +231,12 @@ parse-format-string)."
|
||||
when extra-action
|
||||
do (funcall extra-action (aref objs-arr index)))))
|
||||
|
||||
(defun format-code-name-less-p (c1 c2)
|
||||
"Return non-nil if C2 sorts after C1 (both are format code names)."
|
||||
(if (equalp c1 c2)
|
||||
(and (not (eql c1 c2)) (upper-case-p c2))
|
||||
(char-lessp c1 c2)))
|
||||
|
||||
(defun print-format-info (stream &rest name-directive-pairs)
|
||||
(format stream "~
|
||||
Format strings use C-style and printf-style escape sequences. Each character
|
||||
@ -251,8 +257,9 @@ the initial % character)~%")
|
||||
The recognized printf-style sequences for ~A are:
|
||||
\"%%\" - a literal %
|
||||
*\"%#\" - the index of the current item (used when prompting)~%" name)
|
||||
do (dolist (code (sort (copy-list directive) #'char-lessp
|
||||
:key #'format-code-name))
|
||||
do (dolist (code (stable-sort
|
||||
(copy-list directive) #'format-code-name-less-p
|
||||
:key #'format-code-name))
|
||||
(with-slots (name doc padder) code
|
||||
(format stream " ~:[ ~;*~]\"%~A\"~@[ - ~A~]~%"
|
||||
padder name doc)))
|
||||
|
||||
Reference in New Issue
Block a user