transient
transient copied to clipboard
Allow transient-switches to have descriptions for choices
This small patch allows choices in transient-switches to be each a cons so that options that accept non-descriptive values can still be displayed with descriptive text.
I created this as a pull-request draft since, if this is of interest, a similar change to transient-option would also be needed for consistency.
Example usage:
(defun snowcone-eater (args)
(interactive (list (transient-args 'transient-toys-snowcone-eater)))
(message "%S" args))
(transient-define-argument transient-toys--snowcone-flavor ()
:description "Flavor of snowcone"
:class 'transient-switches
:key "s"
:argument-format "--snowcone=%s"
:argument-regexp "\\(--snowcone=\\(2\\|3\\|4\\|8\\)\\)"
:choices '("none"
(2 . "grape")
(3 . "orange")
(4 . "cherry")
(9 . "lime")))
(transient-define-prefix transient-toys-snowcone-eater ()
"Eat a flavored snowcone!"
:value '("--orange-snowcone")
["Arguments"
(transient-toys--snowcone-flavor)
("C-c C-s" "Show options"
snowcone-eater
:transient t)])
(transient-toys-snowcone-eater)