added tests for SpiderState extension
[scrapy.git] / extras / scrapy_bash_completion
blob17e16251070fa7118dde4d85a55976e35f68ebc5
1 # bash completion for the Scrapy command-line tool
3 _scrapy_completion() {
4     local cmd cur commands spiders
5     cmd=${COMP_WORDS[1]}
6     cur=${COMP_WORDS[2]}
7     case "$cmd" in
8         crawl|edit)
9             spiders=$(scrapy list 2>/dev/null) || spiders=""
10             COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W "$spiders" -- "$cur"))
11         ;;
12         *)
13             if [ $COMP_CWORD -eq 1 ]; then
14                 commands="crawl deploy fetch genspider list parse queue runserver runspider settings shell startproject view"
15                 COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W "$commands" -- "$cmd"))
16             fi
17         ;;
18     esac
20 complete -F _scrapy_completion -o default scrapy