[ECOS] bash_completion for ecosconfig

Sergei Gavrikov sg@belvok.com
Tue Dec 2 14:33:00 GMT 2008


Hello,

Has anyone own bash_completion for ecosconfig? If you have, please, give
yours for us (CLI guys :-) Today I thought, Why I have not such a thing?
I'm not familiar with all bash completion insides, so, I found one nice
template and just adopt it.

# lazy bash_completion for ecosconfig
_ecosconfig() {
	COMPREPLY=()
	local cur="${COMP_WORDS[COMP_CWORD]}"
	local opts="add check export import list new remove resolve target template tree version cygmon cygmon_no_kernel default kernel lwip_eth lwip_ppp minimal net old_net posix redboot stubs uitron"

	COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
}
complete -F _ecosconfig ecosconfig
# vim: set ft=sh:

SYNOPSYS

$ ecosconfig [TAB]
add               kernel            old_net           template
check             list              posix             tree
cygmon            lwip_eth          redboot           uitron
cygmon_no_kernel  lwip_ppp          remove            version
default           minimal           resolve           
export            net               stubs             
import            new               target


This lazy version is the very simple. It does not handle ecosconfig
qualifiers and other. But what I need to complete? I need to complete
recently used subcommands, my favorite target and package names (these
does not present there), no more than. So, that 'opts' variable can be
yours. Just change it. I hope that you can even grep/awk ecos.db to
inspire more power in that simple _ecosconfig() function.

Any scripts welcome!

Regards,

Sergei

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss



More information about the Ecos-discuss mailing list