1
0
mirror of https://github.com/scrapy/scrapy.git synced 2025-02-25 04:43:51 +00:00
scrapy/extras/scrapy_bash_completion
2011-06-05 22:02:56 -03:00

21 lines
696 B
Plaintext

# 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|edit)
spiders=$(scrapy list 2>/dev/null) || spiders=""
COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W "$spiders" -- "$cur"))
;;
*)
if [ $COMP_CWORD -eq 1 ]; then
commands="crawl deploy fetch genspider list parse queue runserver runspider settings shell startproject view"
COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W "$commands" -- "$cmd"))
fi
;;
esac
}
complete -F _scrapy_completion -o default scrapy