Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>After some research I've found a solution. I don't know how it looks in Cisco, but I know how it works in Vyatta. The only flaw is that in this variant you have to press <kbd>TAB</kbd> 3 times to get a detailed help for the first time (first two times normal completion is printed). Once detailed help was shown, next <kbd>TAB</kbd>s will toggle normal and detailed completion.</p> <pre><code>comment_show_last_detailed=1 comment_show_last_position=0 _comment_show() { local cur opts i opt comment opts comments opts="result1 result2" comments="comment1 comment2" [ $comment_show_last_position -gt $COMP_POINT ] &amp;&amp; comment_show_last_position=0 if [ $comment_show_last_detailed = 0 ] &amp;&amp; [ $comment_show_last_position = $COMP_POINT ]; then for ((i=1; ;++i)); do opt=`echo "$opts" | cut -f$i -d$'\n'` [ -z "$opt" ] &amp;&amp; break comment=`echo "$comments" | cut -f$i -d$'\n'` echo echo -n "$opt - $comment" done comment_show_last_detailed=1 COMPREPLY= else cur="${COMP_WORDS[COMP_CWORD]}" SAVEIFS="$IFS" IFS=$'\n' COMPREPLY=( $(compgen -W "${opts}" ${cur}) ) IFS="$SAVEIFS" comment_show_last_detailed=0 fi comment_show_last_position=$COMP_POINT } complete -F _comment_show comment </code></pre> <p>I even managed to reduce <kbd>TAB</kbd> pressings to only 2 using <code>COMP_TYPE</code> variable, but there is a problem that bash doesn't reprint current command line at the bottom line if some symbols were inserted after first <kbd>TAB</kbd> pressing, so there is a space for further research.</p>
 

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