Some commands have many -x
(x
can be any English letter) options and it's some times difficult to remember all of their meanings. I can use bash's compgen -W '-a -b -c'
to show possible options and I'm wondering if it's possible to also show some help message. Like this:
bash# foo -<TAB><TAB>
-a: This is option a -b: This is option b
-C: This is option c
bash#
I ever did something similar to map some of
curl
's single char options (like-x
) to GNU style--long-option
s.This is how it works:
Not exactly what you asked but you can update it for your own purpose.
(I'm not sure if bash can handle whitespaces in the completion result but at least you can use
_
or-
. :-)