linux - Use compgen to get autocomplete for another command, which flag to use? -
i have custom auto-completed command (call commanda
)
in commandb
want steal autocomplete options first argument commanda
so, example options argument1 commanda are:
abcdef
abcabc
abc123
i along lines of compgen -? "commanda"
or compgen -? "commanda abc"
generate list above.
you can use complete -p commanda
find out function invoked custom completion command. (you need argument -f option. if there other optiond, becomes more complicated.)
you need set standard completion environment variables (whose names start comp_) , call function appropiate arguments. fill in compreply variable; if necessary, add other possibilities. see bash manual details.
Comments
Post a Comment