add jekyll completion
This commit is contained in:
		
							parent
							
								
									c0a2c0c933
								
							
						
					
					
						commit
						c35a6318b6
					
				|  | @ -0,0 +1,145 @@ | ||||||
|  | #compdef jekyll | ||||||
|  | # ------------------------------------------------------------------------------ | ||||||
|  | # Description | ||||||
|  | # ----------- | ||||||
|  | # | ||||||
|  | #  Completion script for jekyll(http://jekyllrb.com) | ||||||
|  | # | ||||||
|  | # ------------------------------------------------------------------------------ | ||||||
|  | # Authors | ||||||
|  | # ------- | ||||||
|  | # | ||||||
|  | #  * farseer90718 (https://github.com/farseer90718) | ||||||
|  | # | ||||||
|  | # ------------------------------------------------------------------------------ | ||||||
|  | 
 | ||||||
|  | local ret=1 state | ||||||
|  | 
 | ||||||
|  | local -a common_ops | ||||||
|  | common_ops=( | ||||||
|  |   {-v,--version}"[Display version information]" | ||||||
|  |   {-h,--help}"[Display help documentation]" | ||||||
|  |   {-p,--plugins}"[Plugins directory (defautls to ./_plugins)]: :_directories" | ||||||
|  |   {-s,--source}"[Source directory (defaults to ./)]: :_directories" | ||||||
|  |   {-d,--destination}"[Destination directory (defautls to ./_site)]: :_directories" | ||||||
|  |   "--layouts=[Layouts directory (defaults to ./_layouts)]: :_directories" | ||||||
|  |   "--safe=[Safe mode (defaults to false)]" | ||||||
|  | ) | ||||||
|  | 
 | ||||||
|  | typeset -A opt_args | ||||||
|  | _arguments \ | ||||||
|  |   ':subcommand:->subcommand' \ | ||||||
|  |   $common_ops \ | ||||||
|  |   '*::options:->options' && ret=0 | ||||||
|  | 
 | ||||||
|  | case $state in | ||||||
|  |   subcommand) | ||||||
|  |     local -a subcommands | ||||||
|  |     subcommands=( | ||||||
|  |       "build:Build your site" | ||||||
|  |       "docs:Launch local server with docs for jekyll" | ||||||
|  |       "doctor:Search site and print specific deprecation warnings" | ||||||
|  |       "help:Dislplay global or [command] help documentation" | ||||||
|  |       "import:Import your old blog to Jekyll" | ||||||
|  |       "new:Creates a new Jekyll site scaffold in PATH" | ||||||
|  |       "serve:Serve your stie locally" | ||||||
|  |     ) | ||||||
|  | 
 | ||||||
|  |     _describe -t subcommands 'jekyll subcommand' subcommands && ret=0 | ||||||
|  |   ;; | ||||||
|  | 
 | ||||||
|  |   options) | ||||||
|  |     local -a args | ||||||
|  |     args=( | ||||||
|  |       $common_ops | ||||||
|  |     ) | ||||||
|  | 
 | ||||||
|  |     local -a config | ||||||
|  |     config=( | ||||||
|  |       "--config[Custome configuration file]: :_files" | ||||||
|  |     ) | ||||||
|  |     local -a help | ||||||
|  |     help=( | ||||||
|  |       {-h,--help}"[Display help information]" | ||||||
|  |     ) | ||||||
|  |     local -a build | ||||||
|  |     build=( | ||||||
|  |       {-w,--watch}"[Watch for changes and rebuild]" | ||||||
|  |       "--limit_posts[Limits the number of posts to parse and publish]" | ||||||
|  |       "--future[Publishes posts with a future date]" | ||||||
|  |       "--lsi[Use LSI for improved related posts]" | ||||||
|  |       "--drafts[Render posts in the _drafts folder]" | ||||||
|  |     ) | ||||||
|  | 
 | ||||||
|  |     case $words[1] in | ||||||
|  |       help) | ||||||
|  |         args=() | ||||||
|  |         compadd "$@" build docs doctor help import new serve | ||||||
|  |       ;; | ||||||
|  | 
 | ||||||
|  |       build) | ||||||
|  |         args+=( | ||||||
|  |           $build | ||||||
|  |           $config | ||||||
|  |         ) | ||||||
|  |       ;; | ||||||
|  | 
 | ||||||
|  |       docs) | ||||||
|  |         args=( | ||||||
|  |           {-p,--port}"[Port to listen on]: :_ports" | ||||||
|  |           {-u,--host}"[Host to bind to]: :_hosts" | ||||||
|  |           $help | ||||||
|  |         ) | ||||||
|  |       ;; | ||||||
|  | 
 | ||||||
|  |       doctor) | ||||||
|  |         args+=( | ||||||
|  |           $config | ||||||
|  |         ) | ||||||
|  |       ;; | ||||||
|  | 
 | ||||||
|  |       import) | ||||||
|  |         args=( | ||||||
|  |           "--source[Source file or URL to migrate from]:url" | ||||||
|  |           "--file[File to migrate from]: :_files" | ||||||
|  |           "--dbname[Database name to migrate from]:database" | ||||||
|  |           "--user[Username to use when migrating]:user" | ||||||
|  |           "--pass[Password to use when migrating]:password" | ||||||
|  |           "--host[Host address to use when migrating]:url" | ||||||
|  |           $help | ||||||
|  |         ) | ||||||
|  |       ;; | ||||||
|  | 
 | ||||||
|  |       new) | ||||||
|  |         args=( | ||||||
|  |           ": :_directories" | ||||||
|  |           "--force[Force creation even if PATH already exists]" | ||||||
|  |           "--blank[Creates scaffolding but with empty files]" | ||||||
|  |           $help | ||||||
|  |         ) | ||||||
|  |       ;; | ||||||
|  | 
 | ||||||
|  |       serve) | ||||||
|  |         args+=( | ||||||
|  |           $build | ||||||
|  |           $config | ||||||
|  |           {-P,--port}"[Port to listen on]: :_posts" | ||||||
|  |           {-H,--host}"[Host to bind to]: :_hosts" | ||||||
|  |           {-b,--baseurl}"[Base URL]:url" | ||||||
|  |         ) | ||||||
|  | 
 | ||||||
|  |     esac | ||||||
|  | 
 | ||||||
|  |     _arguments $args && ret=0 | ||||||
|  |   ;; | ||||||
|  | esac | ||||||
|  | 
 | ||||||
|  | return ret | ||||||
|  | 
 | ||||||
|  | # Local Variables: | ||||||
|  | # mode: Shell-Script | ||||||
|  | # sh-indentation: 2 | ||||||
|  | # indent-tabs-mode: nil | ||||||
|  | # sh-basic-offset: 2 | ||||||
|  | # End: | ||||||
|  | # vim: ft=zsh sw=2 ts=2 et | ||||||
		Loading…
	
		Reference in New Issue