1
0
mirror of https://github.com/scrapy/scrapy.git synced 2025-02-22 06:13:24 +00:00

Added bash completion for the Scrapy command-line tool. Closes #210

This commit is contained in:
Pablo Hoffman 2010-08-21 03:23:45 -03:00
parent f80ae9af66
commit 0d9e75c684
2 changed files with 19 additions and 0 deletions

View File

@ -1 +1,2 @@
debian/tmp/usr
extras/scrapy_bash_completion etc/bash_completion.d/

View File

@ -0,0 +1,18 @@
# bash completion for the Scrapy command-line tool
_scrapy_completion() {
local cmd cur commands spiders
cmd=${COMP_WORDS[1]}
cur=${COMP_WORDS[2]}
case "$cmd" in
crawl)
spiders=$(scrapy list 2>/dev/null) || spiders=""
COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W "$spiders" -- "$cur"))
;;
*)
commands="crawl fetch genspider list parse queue runserver runspider settings shell startproject view"
COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W "$commands" -- "$cmd"))
;;
esac
}
complete -F _scrapy_completion -o default scrapy