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 |     (clingon:make-option | ||||||
|      :flag |      :flag | ||||||
|      :key :quiet |      :key :quiet | ||||||
|      :description "suppress print matches (use with -t)" |      :description "don't print matches (use with -t)" | ||||||
|      :short-name #\q |      :short-name #\q | ||||||
|      :long-name "quiet")))) |      :long-name "quiet")))) | ||||||
|  |  | ||||||
|  | |||||||
| @ -156,7 +156,7 @@ instead." | |||||||
|                   :type string |                   :type string | ||||||
|                   :initform "" |                   :initform "" | ||||||
|                   :documentation "The used-passed format string.")) |                   :documentation "The used-passed format string.")) | ||||||
|   (:default-initargs :parameter "FORMAT-CONTROL") |   (:default-initargs :parameter "FORMAT") | ||||||
|   (:documentation "Option that takes a format string.")) |   (:documentation "Option that takes a format string.")) | ||||||
|  |  | ||||||
| (defmethod clingon:initialize-option ((option option-format-string) &key) | (defmethod clingon:initialize-option ((option option-format-string) &key) | ||||||
| @ -231,6 +231,12 @@ parse-format-string)." | |||||||
|             when extra-action |             when extra-action | ||||||
|               do (funcall extra-action (aref objs-arr index))))) |               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) | (defun print-format-info (stream &rest name-directive-pairs) | ||||||
|   (format stream "~ |   (format stream "~ | ||||||
| Format strings use C-style and printf-style escape sequences. Each character | 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: | The recognized printf-style sequences for ~A are: | ||||||
|   \"%%\" - a literal % |   \"%%\" - a literal % | ||||||
|  *\"%#\" - the index of the current item (used when prompting)~%" name) |  *\"%#\" - the index of the current item (used when prompting)~%" name) | ||||||
|         do (dolist (code (sort (copy-list directive) #'char-lessp |         do (dolist (code (stable-sort | ||||||
|                                :key #'format-code-name)) |                           (copy-list directive) #'format-code-name-less-p | ||||||
|  |                           :key #'format-code-name)) | ||||||
|              (with-slots (name doc padder) code |              (with-slots (name doc padder) code | ||||||
|                (format stream " ~:[ ~;*~]\"%~A\"~@[ - ~A~]~%" |                (format stream " ~:[ ~;*~]\"%~A\"~@[ - ~A~]~%" | ||||||
|                        padder name doc))) |                        padder name doc))) | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user