mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-03-20 03:13:33 +01:00
Add scrapy plugin
This commit is contained in:
parent
75b9030f48
commit
2e8fddd2a6
2 changed files with 75 additions and 0 deletions
33
plugins/scrapy/README.md
Normal file
33
plugins/scrapy/README.md
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
## Scrapy zsh completion
|
||||
|
||||
Auto completion for scrapy command-line tool
|
||||
|
||||
#### commands
|
||||
|
||||
```
|
||||
scrapy [tab]
|
||||
|
||||
scrapy commands
|
||||
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
|
||||
```
|
||||
|
||||
if check/crawl/edit is chosen
|
||||
|
||||
```
|
||||
scrapy check [tab]
|
||||
dmoz
|
||||
```
|
||||
|
||||
spiders are listed.
|
||||
42
plugins/scrapy/_scrapy
Normal file
42
plugins/scrapy/_scrapy
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
#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
|
||||
Loading…
Add table
Add a link
Reference in a new issue