Skip to content

Commit 936266a

Browse files
committed
Merge pull request scrapy#934 from Dineshs91/zsh-support
[MRG+1] Added zsh completion for Scrapy command-line tool and updated bash completion
2 parents 8177387 + d55ae53 commit 936266a

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

debian/scrapy.install

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
extras/scrapy_bash_completion etc/bash_completion.d/
2+
extras/scrapy_zsh_completion /usr/share/zsh/vendor-completions/_scrapy

extras/scrapy_zsh_completion

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#compdef scrapy
2+
3+
# zsh completion for the Scrapy command-line tool
4+
5+
_scrapy() {
6+
local curcontext="$curcontext" cmd spiders
7+
typeset -A opt_args
8+
cmd=$words[2]
9+
10+
case "$cmd" in
11+
crawl|edit|check)
12+
spiders=$(scrapy list 2>/dev/null) || spiders=""
13+
if [[ -n "$spiders" ]]; then
14+
compadd `echo $spiders`
15+
fi
16+
;;
17+
*)
18+
if [[ CURRENT -eq 2 ]]; then
19+
_arguments '*: :(check crawl edit fetch genspider list parse runspider settings shell startproject version view)'
20+
fi
21+
;;
22+
esac
23+
}
24+
25+
_scrapy

0 commit comments

Comments
 (0)