문제

I sweated over the question above. The answer I'm going to supply took me a while to piece together, but it still seems hopelessly primitive and hacky compared to what one could do were completion to be redesigned to be less staticky. I'm almost afraid to ask if there's some good reason that completion logic seems to be completely divorced from the program it's completing for.

도움이 되었습니까?

해결책

I wrote a command line library (can be seen in scala trunk) which lets you flip a switch to have a "--bash" option. If you run

./program --bash

It calculates the completion file, writes it out to a tempfile, and echoes

. /path/to/temp/file

to the console. The result is that you can use backticks like so:

`./program --bash`

and you will have completion for "program" in the current shell since it will source the tempfile.

For a concrete example: check out scala trunk and run test/partest.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top