Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Yes, but you need a bit of bash kung foo in order to build such system. The way completion usually works is by binding normal functions to the commands you want to complete. You can find some <a href="http://www.debian-administration.org/articles/317" rel="nofollow">basic examples</a> around to better understand how completion works, and start developing your completion functions. Also, if you happen to have the <code>bash-completion</code> package installed, you could search your system for a number of other examples that currently drive completion in your shell.</p> <p>You could also have a look at the <a href="http://www.gnu.org/software/bash/manual/bash.html#Programmable-Completion" rel="nofollow">completion section</a> of the official bash manual.</p> <hr> <p>EDIT</p> <p>I tried some experiments, and my conclusion is now that you <strong>can't</strong> do exactly what you're after: bash doesn't support help text next to <code>complete</code> results. What you can do is to <strong>add</strong> the legend for the provided completing words. This can be done either in a bash function <code>_myfoo</code> to be used as <code>complete -F _myfoo</code>, or a command via <code>complete -C myfoo</code>, which prints out the legend before completing.</p> <p>The main difference is that using a function you're bound to Bash, while commands can be written in any language you choose, as long as it's able to set the required environment variables.</p> <p>Here's a little example:</p> <pre><code>skuro$ touch ~/bin/myfoo skuro$ chmod +x ~/bin/myfoo skuro$ _myfoo(){ &gt; echo "result1 -- number one" &gt; echo "result2 -- number two" &gt; local cur prev &gt; _get_comp_words_by_ref cur prev &gt; COMPREPLY=( $(compgen -W "result1 result2" "$cur") ) &gt; return 0 &gt; } skuro$ complete -F _myfoo myfoo skuro$ myfoo result&lt;TAB&gt; result1 -- number one result2 -- number two result1 result2 </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload