
에서 탭 완성을 사용하려고 하면 rake
파일만 제안됩니다.
$ rails test-app | grep -v create; cd test-app
$ rake <TAB><TAB>
app/ db/ lib/ public/ README test/ vendor/
config/ doc/ log/ Rakefile script/ tmp/
패키지에는 rake-0.8.7-2
Bash 완료 구성 파일이 포함되어 있습니다.
$ debsums -e rake
/etc/bash_completion.d/rake OK
따라서 탭을 누르면 긁어모을 수 있는 작업이 제안될 것으로 예상됩니다.
$ rake --tasks
(in ~/sandbox/test-app)
rake db:abort_if_pending_migrations # Raises an error if there are pending migrations
rake db:charset # Retrieves the charset for the current environment's database
rake db:collation # Retrieves the collation for the current environment's database
rake db:create # Create the database defined in config/database.yml for the current RAIL...
rake db:create:all # Create all the local databases defined in config/database.yml
rake db:drop # Drops the database for the current RAILS_ENV
...
내가 도대체 뭘 잘못하고있는 겁니까?
rake를 다시 설치하고 컴퓨터를 다시 시작한 후에도 문제가 지속됩니다. 내 ~/.bashrc
포함 내용:
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
. /etc/bash_completion
fi
하지만 완료가 rake
등록되지 않은 것 같습니다.
$ complete | grep rake
$
. /etc/bash_completion
셸에서 명시적으로 실행해도 문제가 해결되지 않지만 다음 명령을 실행하면 rake
일시적으로 완료가 활성화됩니다.
$ grep complete /etc/bash_completion.d/rake
[ -n "${have:-}" ] && complete -F _rake $filenames rake
$ complete -F _rake rake
$ rake <TAB><TAB>
db:abort_if_pending_migrations db:version rails:update
db:charset doc:app rails:update:application_controller
db:collation doc:clobber_app rails:update:configs
db:create doc:clobber_plugins rails:update:generate_dispatchers
db:create:all doc:clobber_rails rails:update:javascripts
db:drop doc:guides rails:update:scripts
...
답변1
셸을 열면 탭 완성이 로드됩니다. 애플리케이션을 설치할 때 셸을 다시 열거나 다음 명령을 실행하여 새 bash 완성을 로드해야 합니다.
. /etc/bash_completion
그럴 것 같아버그안에 rake
. [ -n "${have:-}" ]
이름이 지정된 변수가 $have
설정되어 있는지 확인합니다. 이전 호출이 실패한 경우에는 작동하지 않습니다. 다음으로 교체하세요 have rake
.
have rake && complete -F _rake $filenames rake