1
0
mirror of https://github.com/scrapy/scrapy.git synced 2025-02-23 10:24:01 +00:00
scrapy/extras/scrapy_bash_completion

21 lines
698 B
Plaintext
Raw Normal View History

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