1

So when I type:

grep --recTab

I get:

grep --recursive

but

(and that's a big but) I have defined a few aliases:

alias grep-blue='GREP_COLOR='\''1;34'\'' grep --color=always'
alias grep-red='GREP_COLOR='\''1;31'\'' grep --color=always'
alias grep-yellow='GREP_COLOR='\''1;33'\'' grep --color=always'

which allow me to do funky stuff like this:

gsettings list-recursively | grep-yellow settings | grep-blue power | grep-red true

which gives me: Coloured grep output However in my aliases, there is no prediction for the command-line parameters, so typing:

grep-blue --recTab

doesn't do anything!

and I had a look at:

How do I set up bash completion for command arguments?
How to create script with auto-complete?

but those seem to be a bit outdated and I can't seem to figure it out, because I did find that /usr/share/bash-completion contains:

# makeinfo and texi2dvi are defined elsewhere.
complete -F _longopt a2ps awk base64 bash bc bison cat colordiff cp csplit \
    cut date df diff dir du enscript env expand fmt fold gperf \
    grep grub head indent irb ld ldd less ln ls m4 md5sum mkdir mkfifo mknod \

so I added grep-blue grep-cyan grep-green grep-grey grep-magenta grep-red grep-white grep-yellow \ next to grep but that doesn't seem to help neither!

What am I missing here?

Fabby
  • 35,017

0 Answers0