mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-03-20 03:13:33 +01:00
42 lines
No EOL
1.2 KiB
Text
42 lines
No EOL
1.2 KiB
Text
#compdef scrapy
|
|
|
|
# zsh completion for the Scrapy command-line tool
|
|
|
|
_scrapy() {
|
|
local curcontext="$curcontext" cmd spiders
|
|
typeset -A opt_args
|
|
cmd=$words[2]
|
|
|
|
local -a _1st_arguments
|
|
_1st_arguments=(
|
|
"check":"Check spider contracts",
|
|
"crawl":"Run a spider",
|
|
"edit":"Edit spider",
|
|
"fetch":"Fetch a URL using the Scrapy downloader",
|
|
"genspider":"Generate new spider using pre-defined templates",
|
|
"list":"List available spiders",
|
|
"parse":"Parse URL (using its spider) and print the results",
|
|
"runspider":"Run a self-contained spider (without creating a project)",
|
|
"settings":"Get settings values",
|
|
"shell":"Interactive scraping console",
|
|
"startproject":"Create new project",
|
|
"version":"Print Scrapy version",
|
|
"view":"Open URL in browser, as seen by Scrapy"
|
|
)
|
|
|
|
case "$cmd" in
|
|
crawl|edit|check)
|
|
spiders=$(scrapy list 2>/dev/null) || spiders=""
|
|
if [[ -n "$spiders" ]]; then
|
|
compadd `echo $spiders`
|
|
fi
|
|
;;
|
|
*)
|
|
if [[ CURRENT -eq 2 ]]; then
|
|
_describe -t commands "scrapy commands" _1st_arguments
|
|
fi
|
|
;;
|
|
esac
|
|
}
|
|
|
|
_scrapy |