I created a beautiful autocompletion for my script.
One thing though: when the argument is left for the user to decide (for example, the first argument is the name of the new project), I'd like to display a little line describing what is expected.
For example:
$> script [TAB][TAB]
<name of project>
$> script my_new_project
.
Of course, I thought about this:
if [ $COMP_CWORD -eq 1 ]; then
local IFS=$'\n'
COMPREPLY+=($(compgen -W "<name of project>"))
The problem though is that I obtain this:
$> script [TAB][TAB]
$> script <name of project>
That is, the one text I defined is automatically added to the command line when I press TAB.
.
I also tried this:
local IFS=$':'
COMPREPLY+=($(compgen -W "Help: <domain name associated with the project>"))
But the result is garbled, and it still add the words to the command line:
$> script [TAB][TAB]
<domain name associated with the project> Help:
$> script <domain name associated with the project>
.
Please, do you know if there's a sort of heredoc
for autocompletion, where a help text just appears, but is not added to the command line?
Thank you!