When using compdef
for ZSH completion, I would like to display a "nice" name to a user (e.g. a device name) and when it is selected, a different value is injected (e.g. device serial number / UUID).
How can this be done with _arguments
/ _alternative
/ _describe
?
Specifically, I have function list-devices
that will return ( devA devB devC )
, and a separate shell script that will convert e.g. devA
into UUID1234
. I want the user to be able to select devA
, and have UUID1234
appear on the command line.